Ways to remove the first line

From Rizzo_Lab
Revision as of 11:19, 18 August 2008 by 129.49.109.154 (talk)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Remove the first line from a file.

 wc -l ${file}.csv
 # line = the number of lines
 set line = `wc -l ${file}.csv | awk '{print $1}'
 #subtract 1 from line (integer) 
 @ line = $line - 1
 # copy all to new file except first line  
 tail -$line ${file}.csv > ${file}.new.csh
 

using sed

 sed '1d' filename > newfile


Remove new lies from a file ("\n").