|
read a file line by line in ksh
Hi,
In ksh we use 'while read line' statement to read a file line by line. In my input file I have 5 spaces appended at the end of each line. When I use while read line statement it chops off the spaces at the end of each line
Inp.txt
aaaa<five spaces>
bbbb<five spaces>
cccc<five spaces>
pgm.ksh
#!/bin/ksh
while read line
do
len=`echo "$line" | wc -c`
echo $len
done
my_output
5
5
5
But my expected output should be,
10
10
10
Kindly help me on this.
Thanks in advance,
Chella.
|