Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-10-2007, 05:00 PM   #1
LQ Newbie
Registered: Jan 2006
Posts: 12

Rep: Reputation: 0
awk to remove first 3 lines and print remaining $1, $2 fields

How would I use awk to remove the first few lines while printing the fields on the remaining lines?


Header: This line is useless
Header2: This line is useless
Header3: This line is useless
John 24 32
Jane 21 33

Desired Output:
John 32
Jane 33

Current Script:
cat | awk '{ if (FNR > 3) printf("%s %s\n", $1, $3) }

[NEVERMIND, got it.]

Last edited by phyx; 01-10-2007 at 05:04 PM.
Old 01-10-2007, 06:21 PM   #2
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
It's always nice to share your success!
At any rate, you don't need to use cat...
awk '{ if (FNR > 3) printf("%s %s\n", $1, $3) }'


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
awk: remove similar lines from logfile peos Programming 7 06-19-2006 08:13 AM
awk/gawk/sed - read lines from file1, comment out or delete matching lines in file2 rascal84 Linux - General 1 05-24-2006 10:19 AM
awk print lines that doesn't have a pattern huynguye Programming 5 05-04-2006 12:08 PM
Supressing Fields w/ AWK Rv5 Programming 3 10-19-2004 12:06 PM
lines remaining when I launch an app or terminal spiteres Linux - General 0 05-27-2003 07:24 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:22 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration