LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2004, 09:47 PM   #1
Rv5
Member
 
Registered: Sep 2003
Distribution: RedHat9
Posts: 114

Rep: Reputation: 15
Supressing Fields w/ AWK


im piping the results of ps into awk. the problem im having is that ps prints out the column heading, like this:

PID
3458
3631
3634
3635
3639
3640
3648
3700
3701
3702

From there I want to pipe it elsewhere, but having the PID at top is really screwing me up. Any way to get rid of that header?

this is the line im using to generate this:
ps u | awk '$4 <= .5 {print $2}' | sort -g
 
Old 10-18-2004, 10:11 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Use sed to delete the first line.

ps u | sed -e 1d | awk '$4 <= .5 {print $2}' | sort -g
 
Old 10-18-2004, 10:17 PM   #3
Rv5
Member
 
Registered: Sep 2003
Distribution: RedHat9
Posts: 114

Original Poster
Rep: Reputation: 15
excellent. thanks a bunch!
 
Old 10-19-2004, 11:06 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Or simply use the 'h' options to ps, so it does nog print the header...
Code:
ps uh | awk '$4 <= .5 {print $2}' | sort -g
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Two New LQ Profile Fields jeremy LQ Suggestions & Feedback 8 07-12-2005 11:10 PM
Help me using kernel_stat fields... arunka Programming 0 03-24-2005 06:18 AM
inittab fields env Linux - General 2 03-04-2005 12:36 PM
compulsory fields masand LQ Suggestions & Feedback 20 09-07-2004 04:33 PM
search for specific text in fields using awk Helene Programming 2 04-23-2004 12:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:48 AM.

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