append end of line with 8 spaces


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting append end of line with 8 spaces
# 1  
Old 11-03-2009
append end of line with 8 spaces

Code:
child_amt=$amount
prev_line="$prev_line $child_amt"

i am getting the result like this
Code:
21234567890001343 000001004OLFXXX029100020091112 0000060

but i want 8 spaces between the eg:
Code:
21234567890001343 000001004OLFXXX029100020091112          0000060

how can i do this in .ksh

Last edited by pludi; 11-03-2009 at 05:50 PM.. Reason: code tags, please...
# 2  
Old 11-03-2009
try
Code:
prev_line="$prev_line        $child_amt"
# or
prev_line="$prev_line"'        '" $child_amt"
# or
printf "%s        %s"  $prev_line $child_amt | read nline
prev_line="$nline"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append Pipes at the end of each line

Hi , I have pipe delimited file containing 12 columns having below data in AIX Input : A|B|C|D|E|F|G|H|I|J|K|L^M A1|B1|C1|D1|E1^M A2|B2|C2^M So in first row i have 11 pipes which is fine. In second row I have 4 pipes, so additional 7 pipes should get append In third row I have 2... (3 Replies)
Discussion started by: sonu_pal
3 Replies

2. Shell Programming and Scripting

append blank spaces at the end of a variable string

Hello, could you please help with this one. I have an input file like this: 123,4567,89000 123456789,9876543,12 and for the output I need strings to be with the fixed length, let's say 15, and if the string is -lt 15 to be populated with blanks at the end until it reach 15, like this: 123 ,4567... (1 Reply)
Discussion started by: apenkov
1 Replies

3. Shell Programming and Scripting

find a certain line and append text to the end of the line

After I create printer queues in AIX, I have to append a filter file location within that printers custom file. within lets say test_queue.txt I need to find the row that starts with :699 and then I need to append on the end the string /usr/local/bin/k_portrait.sh. Now I've gotten the sed... (2 Replies)
Discussion started by: peachclift
2 Replies

4. Shell Programming and Scripting

Append text to end of every line

I've scoured the internet with mixed results. As an amateur I turn to the great minds here. I have a text file of 80 or so lines. I want to add ".pdf" to the end of each line. (For now that's it) Most of the internet points toward using "sed". I don't know coding but can figure things out... (4 Replies)
Discussion started by: spacebase
4 Replies

5. UNIX for Dummies Questions & Answers

Append characters to end of line

Coding in unix shell script. Hi All, Please help Thanks (6 Replies)
Discussion started by: sam12345
6 Replies

6. UNIX for Dummies Questions & Answers

how to append spaces(say 10 spaces) at the end of each line based on the length of th

Hi, I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is. I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies

7. Shell Programming and Scripting

append string with spaces to a line

hi i have a file like (every string contains 16 chars) CTL1330000000000 0000 00 008000 0080000000 i need to form a line and write to a file CTL13300000000000000 00008000 0080000000 total chars should be 64 ... (2 Replies)
Discussion started by: Satyak
2 Replies

8. Shell Programming and Scripting

how to append the pattern at the end of the line

-Hi I have multiple files which contain a line with the word "exec". I need to add the following pattern " -cmode -ccheap" on the same line where "exec" is at the end. Any idea? Thanks a lot in advance to everybody... -A (2 Replies)
Discussion started by: aoussenko
2 Replies

9. Shell Programming and Scripting

Append Spaces At end of each line Leaving Header and Footer

How to append constant No of spaces suppose 52 at end of each line in a file (xyz) excluding first and last line. Please Help me out for the same. (1 Reply)
Discussion started by: deepam
1 Replies

10. Shell Programming and Scripting

How to append words at the end of first line

Hi Unix gurus This is my first post here. I have a file which looks like this: string1,string2 ,string3 ,string4 ... ... I need to append all words below first line to the first line, ie string1,string2,string3,string4,... Bear in mind that it is not known how many lines follow... (11 Replies)
Discussion started by: lmatlebyane
11 Replies
Login or Register to Ask a Question