Linux pipeline commands

From SusoSight

sed

Editing multiple files in place

sed -is 's/From/To/' *.txt


Crazy stuff

Determining the number of Friday the 13ths per year in a range of years

for y in `seq 1800 2009` ; do echo -n "$y: " ; for i in `seq 1 12` ; do cal $i $y | grep " 13 14$" > /dev/null && echo $i ; done | wc -l ; done

Before posting the above to climagic, I found a more efficient and cooler way to do this:

for y in {1700..9000} ; do echo -n "$y: " ; cal $y | fold -w22 | egrep -e "13 14\ *$" | wc -l ; done