Thanks for you replies and advice. This is not a homework assignment. This is a part of my code development. Currently i am using as below. Please let me know whether this is right way or is there any other simple way to pad the spaces.
Thanks.
---------- Post updated at 12:05 PM ---------- Previous update was at 11:53 AM ----------
I will raise my question under proper category by following post rules. Please close this thread.
Thanks
Last edited by Don Cragun; 12-25-2013 at 03:00 PM..
Reason: Add CODE tags
Hi
I am looping through the contents of a file as follows
cat file |while read inrec
do
echo $inrec >> $TMP
done
(obviously this isn't all i am doing as it would be pointless but for the sake of the problem this is the important bit)
The file has fields which are separated by... (1 Reply)
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)
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)
HI
In my script, i am reading the input from the user and want to find the length of the string.
The input may contain leading spaces. Right now, when leading spaces are there, they are not counted.
Kindly help me
My script is like below. I am using the ksh.
#!/usr/bin/ksh
echo... (2 Replies)
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)
child_amt=$amount
prev_line="$prev_line $child_amt"
i am getting the result like this
21234567890001343 000001004OLFXXX029100020091112 0000060
but i want 8 spaces between the eg:
21234567890001343 000001004OLFXXX029100020091112 0000060
how can i do this in .ksh (1 Reply)
i/o file:
abc,efg,xyz
Required o/p file:
"abc (Value + blank spaces=16) " ,"efg (Value +blank spaces=15) " ,"xyz (Value+ blank spaces =20) "
In short input file value stores in result file with " i/p Value " added with spaces and are of fixed size like 16,15,20
How to do using... (2 Replies)
Right now, my code is:
s/Secondary Ins./Secondary Ins.\
1/g
It's adding a 1 as soon as it finds Secondary Ins.
Primary Ins.: MEDICARE B DMERC Secondary Ins.
1: CONTINENTAL LIFE INS
What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
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)
I want to make a script to read row by row and find its length. If the length is less than my required length then i hav to append spaces to that paritucular row. Each row contains special characters, spaces, etc.
For example my file contains ,
12345 abcdef
234 abcde
89012 abcdefgh
... (10 Replies)
Discussion started by: Amrutha24
10 Replies
LEARN ABOUT OPENSOLARIS
append
append(1T) Tcl Built-In Commands append(1T)__________________________________________________________________________________________________________________________________________________NAME
append - Append to variable
SYNOPSIS
append varName ?value value value ...?
_________________________________________________________________DESCRIPTION
Append all of the value arguments to the current value of variable varName. If varName doesn't exist, it is given a value equal to the
concatenation of all the value arguments. The result of this command is the new value stored in variable varName. This command provides
an efficient way to build up long variables incrementally. For example, ``append a $b'' is much more efficient than ``set a $a$b'' if $a
is long.
EXAMPLE
Building a string of comma-separated numbers piecemeal using a loop.
set var 0
for {set i 1} {$i<=10} {incr i} {
append var "," $i
}
puts $var
# Prints 0,1,2,3,4,5,6,7,8,9,10
SEE ALSO concat(1T), lappend(1T)KEYWORDS
append, variable
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWTcl |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for Tcl is available on http://opensolaris.org.
Tclappend(1T)