Since I (and probably others) learn best from examples, I thought it
would be cool if we all could share command line tricks that we've
picked up and use often. Tricks with perl, awk, sed, xargs and all
the other unix tools with redirects and pipes - the works.
I've often written things in perl that someone shows me later can be
done in a single command line using a combination of awk, sed, and
xargs. Since I don't know much about these tools, and probably a lot
of the other tools available, maybe we all can share our tricks.
One that I use often is a perl one-liner to search and replace on a
file (or list of files).
To get rid of those pesky ^M DOS carriage returns, one can type this:
perl -pi -e 's/^M//g' file.txt
I've changed my colors in a webpage by using this:
perl -pi -e 's/#ABCDEF/#123456/g' page.html
-Rob