Notes of a forgetful coder
Showing posts with label
grep
.
Show all posts
Showing posts with label
grep
.
Show all posts
Friday, March 23, 2012
pipe with rm
I wanted to delete a large number of files in a directory that satisfied a certain
criteria
in their name. The command for this is:
find /path/to/dir -name '*criteria*' -exec rm {} \;
or
find /path/to/dir -name '*criteria*'| xargs rm
or
ls | grep criteria | xargs rm
Note: The last command might be slower than the first two.
Friday, June 24, 2011
grep character count
Use grep to count the frequency of a character in a file:
grep o 'character' filename | wc -l
Older Posts
Home
Subscribe to:
Posts (Atom)