![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Padding with zeros. | sbasetty | Shell Programming and Scripting | 3 | 02-06-2007 11:02 PM |
| AWK and padding values | kshelluser | UNIX for Dummies Questions & Answers | 3 | 11-29-2006 02:14 PM |
| Padding variables | flounder | High Level Programming | 1 | 09-05-2006 09:11 AM |
| text formating/Text space padding | hugow | UNIX for Dummies Questions & Answers | 6 | 06-29-2005 06:49 AM |
| Padding | vijaygopalsk | UNIX for Dummies Questions & Answers | 2 | 06-27-2003 07:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I need to create a header record of width 121 charecter with below fields, position 001-001 - 0 position 002-15 - filled with space position 016-020 - date value position 021-121 - filled with space Iam using the below code: echo 0"14 spaces"$date"100 spaces" >> output.txt But I dont think this is correct approach. Could any one please correct me if Iam wrong? With Regards / Lokesha R |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
check the printf command
eg Code:
# printf "%05d" 13 00013 |
|
#3
|
|||
|
|||
|
printf should do it
Code:
printf "%-15d%5s%100s\n" 0 "$date_here" |
|
#4
|
||||
|
||||
|
Thanks to all for the needful answers.
|
||||
| Google The UNIX and Linux Forums |