Select lines from text file

Post date: Jun 29, 2014 9:57:30 PM

Get lines from text file

## The first line only
head -1 mds_out_2014-01-01_2014-01-31_2014-06-28.csv > tmp
## Get the second line only
sed -n 2p mds_out_2014-02-01_2014-02-28_2014-06-28.csv >> tmp
## Get line 10th to 20th (11 lines)
sed -n '10,20p' mds_out_2014-02-01_2014-02-28_2014-06-28.csv >> tmp
## get all lines from 2nd line to the end
tail -n +2 mds_out_2014-02-01_2014-02-28_2014-06-28.csv

more resources:

http://www.commandlinefu.com/commands/view/3802/to-print-a-specific-line-from-a-file

http://stackoverflow.com/questions/339483/how-can-i-remove-the-first-line-of-a-text-file-using-bash-sed-script