- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: field separator
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
тАО08-14-2005 04:01 PM
тАО08-14-2005 04:01 PM
I am using $ps -ef|awk '{print $2 $3}'.
I want to insert field separator between two fields to distinguish the output.
Can anyone help me ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2005 04:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2005 04:07 PM
тАО08-14-2005 04:07 PM
Re: field separator
the separator can be any character that you would be putting between the double quotes:
e.g. "-" or "|"
ps -ef|awk '{print $2 "|" $3}'
or ps -ef|awk '{print $2 "-" $3}'
regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2005 08:50 PM
тАО08-14-2005 08:50 PM
Re: field separator
You also use a comma if you just want to seperate in 2 columns
$ps -ef|awk '{print $2,$3}'
Cheers,
Kasper
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2005 10:29 PM
тАО08-14-2005 10:29 PM
Re: field separator
you can both use " " and , between line
selections so;
$ps -ef|awk '{print $2,$3}'
or
ps -ef|awk '{print $2 " " $3}'
Good Luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-15-2005 02:13 PM
тАО08-15-2005 02:13 PM
Re: field separator
You can customize the field separator to whatever you want i.e. comma, bar, carriage return etc. as long as you specify it within your awk construct like:
# ps -ef | awk '{OFS="
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-15-2005 05:08 PM
тАО08-15-2005 05:08 PM
Re: field separator
There will be many situations where you have to use OFS.
Situations like where your field data contains spaces, tabs and special characters then only OFS will come to your rescue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-15-2005 05:12 PM
тАО08-15-2005 05:12 PM
Re: field separator
ps -ef|awk '{printf("%s | %s\n", $2,$3);}'
-Amit