Count the number of ‘|’ in a file per line.
sed 's/[^|]//g' test.csv | awk '{ print length }'

Print the lines with line number which do not contain ’67’
grep -n -v 67 number_of_pipes.txt

Print line 929064 of file ‘test.txt’
sed '929064q;d' test.txt

Open file ‘test.txt’ in line 929064 with vi
vi +929064 test.txt

The first day of the month two months ago in SQL
select add_months(from_unixtime(unix_timestamp(),'yyyy-MM-01'),-2)

Subtract a month and reformat date:
select from_unixtime(unix_timestamp(add_months(from_unixtime(unix_timestamp(),'yyyy-MM-dd'),-1),'yyyy-MM-dd'),'yyyyMMdd');

Remove DOS linefeeds:
awk 'sub("\r$", "")' myfile > tmp ; mv tmp myfile
from this page.