The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-19-2008
elthox elthox is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 30
Quote:
Originally Posted by trey85stang View Post
Is there a way to tell awk to ignore the first 11 lines of a file?? example, I have a csv file with all the heading information in the first lines. I want to split the file into 5-6 different files but I want to retain the the first 11 lines of the file.

As it is now I run this command:


Code:
cat something.csv | nawk '$2 = /servername/' >> something-new.csv

It cuts off the first 11 lines... Right now im just doing two steps to create the file running sed 11q > something-new.csv then running the above command appending something-new.csv. Is there a way to do that with just nawk so I can eliminate the sed command?

Maybe like this:

cat -n something| awk '$1>11 && (the conditions you like)

cat -n adds to the first coloumn the number of line.

Regards