- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need to append 692 blanco positions to end of stri...
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
03-07-2007 06:54 PM
03-07-2007 06:54 PM
6000 lines. (extract below)
*** HEADER ***
2006474@0001@1K
2006474@0002@1K
2006474@0003@1K
2006474@0004@1K
2006474@0005@1K
2006474@0006@1K
2006474@0007@1K
we need to append 692 blanco spaces after the 1K.
The only way I can thing of is to do
sed 's/1K/1K < here count 692 spaces /g
but that is a bit silly, besides there is a to lose count.
Is there a shorter way to do it , or with another tool like awk or perl ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2007 07:46 PM
03-07-2007 07:46 PM
Re: Need to append 692 blanco positions to end of string
in perl you have the string-repetition Operator (x):
$addstring = " " x 692;
$newstring = $oldstring . $addstring
In shell you could run a little loop 692 times to build up your addstring and then append to the existing record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2007 07:51 PM
03-07-2007 07:51 PM
Re: Need to append 692 blanco positions to end of string
I found also a solution with cut and paste
in a whlle loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2007 07:57 PM
03-07-2007 07:57 PM
Solution(I assume you are smart enough to do 2 or more at a time? ;-)
You can use awk's printf to add the 692 spaces:
awk '{ printf "%s%692s\n", $0,""}' in-file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2007 08:10 PM
03-07-2007 08:10 PM
Re: Need to append 692 blanco positions to end of string
that was exactly what I was looking for !!
Brilliant !!