Hi,
I have an requirement of reading a long line of 7000 chars and cutting it
iam doing this :
while read -r x
do
echo $x
.........
done < `cat filename`
when iam doing this it is giving me "0403-016 Cannot find or open the file."
Can anyone let how this can be done.
The whole UUOC is throwing things out of whack....
while read whatever; do
# whatever
done < filename
Depending on your shell, you may well encounter limits with a line that long anyway....
On a modern shell like bash (on Linux), this copes quite well
$ for i in `seq 1 7000`
> echo -n "a" >> longline
> done
$ echo "" >> longline
$ wc -c longline
7001 longline
$ while read line; do
> echo ${line}
> done < longline
aaaaaaaaa.....
.
....aaaaaaaa
$
Cheers
ZB
For the line,
echo $x
Think about what could happen if there is semicolon/quote/comma within $x.
You may want to try, in bash
echo -E "$r"
Tom