You need to use a different delimiter in the sed substitution command. For example:
$ sed 's|.*/||' file
Event_repeatFILLED.svelte
Miscellaneous_servicesFILLED.svelte
Line_weightFILLED.svelte
ArchitectureFILLED.svelte
...many more lines ...
Alternatively:
$ perl -pe 's|.*/||' file
Event_repeatFILLED.svelte
Miscellaneous_servicesFILLED.svelte
Line_weightFILLED.svelte
ArchitectureFILLED.svelte
...many more lines ...
Or, with awk
:
$ awk -F'/' '{print $NF}' file
Event_repeatFILLED.svelte
Miscellaneous_servicesFILLED.svelte
Line_weightFILLED.svelte
ArchitectureFILLED.svelte
...many more lines ...
Or even something silly like:
$ rev file | cut -d / -f 1 | rev
Event_repeatFILLED.svelte
Miscellaneous_servicesFILLED.svelte
Line_weightFILLED.svelte
ArchitectureFILLED.svelte
...many more lines ...
Or you can use basename
as suggested in the comments but that will be more complicated and slower:
$ while IFS= read -r fileName; do basename -- "$fileName"; done < file
Event_repeatFILLED.svelte
Miscellaneous_servicesFILLED.svelte
Line_weightFILLED.svelte
ArchitectureFILLED.svelte
Finally, if you really want a pure shell solution, you can do:
$ while IFS= read -r fileName; do printf '%s\n' "${fileName##*/}"; done < file
Event_repeatFILLED.svelte
Miscellaneous_servicesFILLED.svelte
Line_weightFILLED.svelte
ArchitectureFILLED.svelte
...many more lines ...
But don't use the two last ones, they are the least efficient and most complex. See Why is using a shell loop to process text considered bad practice?.
basename
which will do what you want? – Bib May 27 '22 at 09:12bash
. A large point of a shell is to glue other commands together to achieve an aim – Chris Davies May 27 '22 at 10:32