Ways to remove the first line

From Rizzo_Lab
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").