- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: filter out a field
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 02:24 AM
тАО12-19-2004 02:24 AM
I run a command to see the status of a process,
this is displayed on tow lines and I want to add the started string to a variable
ie
proc=$(command |awk {'print $2})
however print $2 displays status on the first line and started on the second - how do I pass started into $proc?
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 02:59 AM
тАО12-19-2004 02:59 AM
Re: filter out a field
proc=$(command |awk 'NR>1{print $2}')
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 03:48 AM
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 04:40 AM
тАО12-19-2004 04:40 AM
Re: filter out a field
Are you talking about 'ps' with some options?
In Tru64, contrary to say hpux, you can specifically request any and all indivudual fields with a '-o'. They may reduce the need for post processing.
What problem are you really trying to solve?
That is, what else is the script doing after grabbing thoze fields? We may be able to help you better with a little more awk or perl scripting.
If you need further help, be sure to re-reply with (a text attachment of)
- the command currently used to gather info
- A sample output of that command
- a sample of the desired final output based on the above.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 04:43 AM
тАО12-19-2004 04:43 AM
Re: filter out a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 04:44 AM
тАО12-19-2004 04:44 AM
Re: filter out a field
# a5:/u/usr/merijn 101 > ps
PID TTY TIME COMMAND
19657 pts/0 0:00 ps
19577 pts/0 0:00 tcsh
a5:/u/usr/merijn 102 > env UNIX95=" " ps -o pid
PID
19577
19836
a5:/u/usr/merijn 103 > env UNIX95=" " ps -o pid,tty
PID TT
19577 pts/0
19837 pts/0
a5:/u/usr/merijn 104 > env UNIX95=" " ps -o tty,command
ps: command is not a valid field name
Exit 1
a5:/u/usr/merijn 105 > env UNIX95=" " ps -o tty,cmd
ps: cmd is not a valid field name
Exit 1
a5:/u/usr/merijn 106 > env UNIX95=" " ps -o tty,time
TT TIME
pts/0 00:00
pts/0 00:00
a5:/u/usr/merijn 107 >
Enjoy, Have FUN! H.Merijn
- Tags:
- UNIX95
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2004 04:48 AM
тАО12-19-2004 04:48 AM
Re: filter out a field
Victor your solution still display's both lines
Hein, thanks for your your advise and input however I am learning scripting and would prefer to read and educate myself rather than have half scripts etc supplied
Leif - thanks a million, I have used your command.