Monday, November 08, 2010

Bash math, command expansion and pipes


How do you add the number of lines in two files?


echo $((`wc -l /path/to/file1.txt|cut -f 1 -d ' '`+`wc -l /path/to/file2.txt|cut -f 1 -d ' '`)) 

No comments: