Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

scripting - cat breaking line

From: L.V.Gandhi <lvgandhi(at)gmail.com>
Date: Sat Jun 23 2007 - 17:23:34 EDT


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/

--

To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Received on Sat Jun 23 17:23:58 2007

This archive was generated by hypermail 2.1.8 : Sat Jun 23 2007 - 17:30:02 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library