![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| appending spaces to first line based on second record. | ammu | Shell Programming and Scripting | 2 | 11-16-2007 03:35 AM |
| splitting a record and adding a record to a file | rsolap | Shell Programming and Scripting | 1 | 08-13-2007 01:58 PM |
| Inserting spaces in a record | lyoncc | Shell Programming and Scripting | 5 | 06-01-2007 12:27 PM |
| adding spaces to a line | mgirinath | Shell Programming and Scripting | 4 | 03-23-2007 12:38 PM |
| adding a column at the end of the record | pavan_test | UNIX for Dummies Questions & Answers | 2 | 11-07-2005 11:39 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Adding spaces to record
Hi,
I want to print spaces in a trailer record which is a single command. namely the unix command which i already have recs=`wc -l $TargetFileDir/myfile.txt|cut -c1-9`;export recs;echo 'PCPC.DXDINPT.FC0.INPUTFLE.PASS'`date +%Y%m%d``printf '%015d\n' $recs` >> $TargetFileDir/myfile1.txt I wanted add a filler of say 200 spaces at the end. Is there any way by which i can do in same command |
|
||||
|
Thanks a lot for your efforts and time.
Rather i tried with the printf arguments earlier but rather did not workout. I re-directed the output of the command to file and when i opened the file i could not see any spaces,even with se list option. recs=`wc -l PCPC.DXDINPT.FA0.INPUTFLE.PASS|cut -c1-9`;export recs;echo 'PCPC.DXDINPT.FA0.INPUTFLE.PASS'`date +%Y%m%d``printf '%015d%-200s\n' $recs` Output: PCPC.DXDINPT.FA0.INPUTFLE.PASS20080128000000000000101$ Where $ representing the end of line. Can you provide me some more suggestions |
|
||||
|
It works fine for me, try to give an extra space as follow:
Code:
printf '%015d%-200s\n' $recs ' ' Code:
recs=`wc -l PCPC.DXDINPT.FA0.INPUTFLE.PASS|cut -c1-9`;export recs;echo 'PCPC.DXDINPT.FA0.INPUTFLE.PASS'`date +%Y%m%d``printf '%015d%-200s\n' $recs ' '` |
| Sponsored Links | ||
|
|