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
07-09-2007 06:42 AM
07-09-2007 06:42 AM
awk
Q: what is the correct syntax to copy all fields to create lines longer than 72 characters.
Jacques
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 06:52 AM
07-09-2007 06:52 AM
Re: awk
In general, if you wish to format the output, printf rather than simply print is preferred.
awk '{ printf ("%-10.10s %5s %-12.12s\n",$2,$3,$9") }'
would print the 1st 3 fields in your example above followed by a LF. Awk's printf is modeled after the C printf function so man 3 printf for details although if you will try the above example, it should be fairly obvious what the above example does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 07:26 AM
07-09-2007 07:26 AM
Re: awk
awk '{if (length>72) {print length, $0} }' file-name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 08:06 AM
07-09-2007 08:06 AM
Re: awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 08:14 AM
07-09-2007 08:14 AM
Re: awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 11:41 PM
07-09-2007 11:41 PM
Re: awk
$ vis -n file
$ xd -tc file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2007 08:33 AM
07-10-2007 08:33 AM
Re: awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2007 08:57 AM
07-10-2007 08:57 AM
Re: awk
Try running the attached script. It will produce a line much longer than 72 chars and then send it to awk. It will then attempt to print it field by field. Finally the input file is comapred to the output file. I expect a null output from diff.