LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 08-01-2004, 03:33 AM   #1
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 45
Removing Columns From Output


When I run the ps -ef command I get output. One line is:

Code:
user 12822     1  0 Jul31 ?        00:00:00 kalarmd -session 10a862bbf000106887608500000026650004
Now I need to remove everything to the right of the TIME column leaving only the CMD column.

So what will be left is
Code:
kalarmd -session 10a862bbf000106887608500000026650004
There are different numbers of columns for the processes on the right but I need all that.

Anyone know how to do this?

Last edited by darthtux; 08-01-2004 at 03:35 AM.
 
Old 08-01-2004, 03:45 AM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: Ubuntu, FreeBSD, NetBSD
Posts: 1,449

Rep: Reputation: 47
ps -eo cmdline

That *should* just spit out the full command line.
 
Old 08-01-2004, 05:27 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Quote:
Originally posted by frob23
ps -eo cmdline

That *should* just spit out the full command line.
Remove the red part to make it work:
Code:
ps -eo cmd
 
Old 08-01-2004, 07:38 PM   #4
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480 N, 95.3690 W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Original Poster
Rep: Reputation: 45
Thank you very much. That worked.

Now how to I get only the first column or only the user? What I am trying to do is take the output of ps -ef *before* and *after* reboot (into two files), have only the user and cmd info from each file, do a diff and then paste. The resulting output being the difference in the two files. The PID's etc. will change so I only want to diff and paste the user and cmd info.

Last edited by darthtux; 08-01-2004 at 07:43 PM.
 
Old 08-01-2004, 09:21 PM   #5
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
Then it's:
Code:
ps -eo user,cmd
You will likely have to sort prior to diffing.
 
  


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
printf: postion cursor to output columns schneidz Programming 5 09-20-2005 08:59 AM
Removing the "enter" symbols in the columns of emacs? Erik_the_Red Linux - Software 2 07-18-2005 04:03 PM
Vi Columns Chaitanyayardi Linux - Software 5 05-12-2005 07:27 AM
rows and columns digitalgravy Linux - General 2 03-16-2004 06:47 PM
How can I see the other 10 columns sakulagi Linux - Software 1 06-16-2003 09:45 PM


All times are GMT -5. The time now is 03:17 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration