- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: awk help: field separating
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
Forums
Discussions
Discussions
Discussions
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
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
06-08-2005 09:41 PM
06-08-2005 09:41 PM
Using awk I want to print the fields of /etc/passwd with a few spaces between each field.
Filed1 Filed2 Field3 etc
How can I do this?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 09:44 PM
06-08-2005 09:44 PM
Re: awk help: field separating
awk -F \: '{print $1,$2,$3,$4,$5,$6,$7}' /etc/passwd
Enrico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 09:46 PM
06-08-2005 09:46 PM
Re: awk help: field separating
awk: syntax error near line 1
awk: bailing out near line 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 09:50 PM
06-08-2005 09:50 PM
Re: awk help: field separating
try
#awk -F ":" '{print $1,$2,$3,$4,$5,%6,$7}'
Regards,
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 09:52 PM
06-08-2005 09:52 PM
Re: awk help: field separating
#awk -F ":" '{print $1,$2,$3,$4,$5,%6,$7}' /etc/passwd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 09:56 PM
06-08-2005 09:56 PM
Re: awk help: field separating
Try this
#cat /etc/passwd |awk -F ":" '{print $1,$2,$3,$4,$5,$6,$7}'
it works i have tried.
Cheers!!!
eknath
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 09:59 PM
06-08-2005 09:59 PM
Solutionif you want spaces in between the fields, you can try this:
# awk -F: -v tb=" " '{print $1,tb$2,tb$3,tb$4,tb$5,tb$6,tb$7}' /etc/passwd
the above tb="
But "\t" for tab should also work.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2005 11:03 PM
06-08-2005 11:03 PM
Re: awk help: field separating
awk -F":" '{ print $1tab$2tab$3tab$4tab$5tab$6tab$7tab$8}' tab=" " /etc/passwd
hth.