You could use:
sed -i -E -e 's/(\/.*\/)(.*\.idt)/\2/' file_list
This performs an in-place (-i
) replacement of all /..../filename.idt
filepaths with filename.idt
("all" as in: the first occurrence on each line of a certain file). If there is no absolute path preceding the filename, the regex does not match, and nothing happens. The file_list
can be replaced with an *.xml
or the like at your command prompt. You may want to try running the command without the -i
option first, to see the output before writing it to disk.