'terminal unix command find problem with setting up modes
I have trouble constructing a single find line to do the following: find all files in the current dir and sub-dir with name ending with ~. or star and end with '#'.I think I have made a fundamental mistake but not so sure after 2 hours of thinking.
This is what I came up with and it does not seem to work: find -name '[#]' -a -name '[~#]'
macOSX terminal
Solution 1:[1]
You could use a combination of ls
and grep
to find all the files ending with either ~ or #
ls * | grep -E "*.(\~|#)"
ls -R *
will show all files in the current dir and sub-dir;
grep -E
will search for lines matching a regular expression;
"*.(\~|#)"
will match all lines ending with either ~
or #
(note that you'll need to escape the ~
with \
since it's a special character).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hubert Léveillé Gauvin |