I've got a command that I am trying to understand. Main issue is that the SED command doesn't line up with any examples I've seen before. I don't understand why
find . -name *_<templateName>_*|sed 's#.*/##' > wc_uDriveFiles<monYYYY>.txt
I've got a command that I am trying to understand. Main issue is that the SED command doesn't line up with any examples I've seen before. I don't understand why
find . -name *_<templateName>_*|sed 's#.*/##' > wc_uDriveFiles<monYYYY>.txt
sed's s
command performs search-and-substitute.
The following letter (here #
) separates pattern, replacement and options.
Note that regex pattern is taken greedy.
An example should clarify how it works
$ cat file.txt
abc
ab/c
a/b/c
$ sed 's#.*/##' file.txt
abc
c
c
So, text up to and including the last slash, if any, gets dropped