I spend so much time running find with the -name and -exec switches is silly. Syntax is a bit funky but once you get a handle on it, there isn't much you can't do.
~ # find . -name foo -exec "cat {} >> ~/bar.txt" \;
[read all the file under the current directory who's name matches (regex) foo and write their contents into a file named bar.txt in your home directory.]
Also grep.
~ # grep -r monkey /
[search inside every file under / for text matching "monkey" and print out the matching line]
These are from memory, (I'm at a winows box right now) so I apologize if there are errors in the examples. To hedge here is a bonus tip.
Bonus: try -h or --help switches to pretty much any command for a quick reminder of how it works. Save that brain real estate for more important things than memorizing switches!
I spend so much time running find with the -name and -exec switches is silly. Syntax is a bit funky but once you get a handle on it, there isn't much you can't do. ~ # find . -name foo -exec "cat {} >> ~/bar.txt" \; [read all the file under the current directory who's name matches (regex) foo and write their contents into a file named bar.txt in your home directory.]
Also grep. ~ # grep -r monkey / [search inside every file under / for text matching "monkey" and print out the matching line]
These are from memory, (I'm at a winows box right now) so I apologize if there are errors in the examples. To hedge here is a bonus tip.
Bonus: try -h or --help switches to pretty much any command for a quick reminder of how it works. Save that brain real estate for more important things than memorizing switches!