in ksh I have a input file that holds the following:
$ cat input.txt
A {111 222 111}
B {333,444,333}
C {555 666 555}
$
When I Run the following command Im getting the following
$ while read LINE
> do
> echo $LINE
> done<input.txt
A {111 222 111}
B 333 444 333
C {555 666 555}
$
How to insure to read lines as is with braces and comma?
In order to avoid special syntax with braces and coma in ksh when you are doing an echo, add quotation marks around $LINE
:
while read LINE
do
echo "$LINE"
done<input.txt
The syntax {1,2,3...}
is useful for loops:
for x in {1,a,3}; do echo x=$x; done
x=1
x=a
x=3