Computing.Net > Forums > Unix > awk script help

awk script help

Reply to Message Icon

Original Message
Name: ayon
Date: December 1, 2007 at 01:01:00 Pacific
Subject: awk script help
OS: Solaris2
CPU/Ram: UltraSPARC III / 2048M
Model/Manufacturer: SunBlade2000
Comment:

I have a file which has 2 lines of header information then a series of columns that are seperated by whitespace. How do I use awk to read this file, skip the header lines, extract columns 1, 2, 5 and then output these columns to a new file?



Report Offensive Message For Removal


Response Number 1
Name: fpmurphy
Date: December 1, 2007 at 02:38:53 Pacific
Reply: (edit)

Try:

{
if ( NR > 2 ) { print $1, $2, $5 }
}


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: awk script help

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge