scripting - cat breaking line
I have a file temp1 as below
lvgandhi@lvgvaio:~/stock$ cat temp1
ABB,ABB LTD., 4730.00, 4779.00, 4700.00, 4726.45,59655
ACC,ACC LIMITED, 860.00, 864.90, 844.30, 852.25,228318
When I run on command line as
lvgandhi@lvgvaio:~/stock$ for line in $(cat temp1);do echo "20070622,$line">>temp2 ;done
I get temp2 as
lvgandhi@lvgvaio:~/stock$ cat temp2
20070622,ABB,ABB
20070622,LTD.,
20070622,4730.00,
20070622,4779.00,
20070622,4700.00,
20070622,4726.45,59655
20070622,ACC,ACC
20070622,LIMITED,
20070622,860.00,
20070622,864.90,
20070622,844.30,
20070622,852.25
,228318
line is breaking at every space.
How to avoid this?
I would ike the output to be
20070622,ABB,ABB LTD., 4730.00, 4779.00, 4700.00, 4726.45,59655
or still as
20070622,ABB,ABB LTD.,
4730.00,4779.00,4700.00,4726.45,59655
thus having no space in beginning of field, but maitaining space in strings like ABB LTD.
--
L.V.Gandhi
http://lvgandhi.tripod.com/
Reply to: