Thursday, May 31, 2007

linux command grep tee cat

grep 'macropulse' output* | tee -a /dev/tty macropulse.txt

grep pattern 'macropulse' all files with name output* Then, print the info on screen (/dev/tty) and write the info into a file macropulse.txt (-a option means don't overwrite the file).

grep -n 'macropulse\|noise' output* | tee /dev/tty macropulse.txt

-n option means with line number; 'macropulse\|noise' means two patterns 'macropulse' and 'noise'.

No comments: