Using Raku (formerly known as Perl_6)
~$ raku -ne 'put IO::Spec::Win32.basename($_);' stuff.txt
#OR
~$ raku -ne 'put IO::Spec::Win32.basename($_.trim-trailing);' stuff.txt
Raku is a programming language in the Perl-family. The code above takes your file paths and treats them as IO objects, of which there are four main classes (Unix, Windows, Cygwin, and QNX). Because you have Windows paths, the IO::Spec::Win32 method is called (to correctly understand the path delimiter). Finally basename gives you the file name. There seems to be some whitespace at the end of the lines, which can be cleaned up with trim or trim-trailing.
Sample Input:
c:\users\none\file1.txt
c:\users\none\file2.txt
g:\home\share\make.log
Sample Output:
file1.txt
file2.txt
make.log
https://docs.raku.org/type/IO/Spec/Win32
https://docs.raku.org/routine/basename
https://raku.org
basenameit. – ctrl-alt-delor Jul 17 '23 at 20:37sed 's-.*\\__'should do the trick. Double-backslash as escaped backslash. – Philippos Jul 18 '23 at 05:19