line processing slow
- From: "Terence" <someone@xxxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 20:40:08 +0800
Hi,
I've a data file with 1million lines. Eg.
aaaaabbbbbbccccddd <- fix column
........
.......
I wanted to insert a comma ','.
This is what i did:
cat $inputfile | while read line
do
field1=`echo $line | cut -c1-5`
field2=`echo $line |cut -c6-11`
field3=`echo $line |cut -c12-15`
echo ${field1},${field2},${field3} >> outputfile
done
for 1million lines, the processing is painful.
Is there any more efficient way of doing the input/output?
Thanks and regards
.
- Follow-Ups:
- Re: line processing slow
- From: John W. Krahn
- Re: line processing slow
- From: Chris F.A. Johnson
- Re: line processing slow
- From: Janis
- Re: line processing slow
- From: Ed Morton
- Re: line processing slow
- Prev by Date: Re: Sed: removing XML headers
- Next by Date: Re: line processing slow
- Previous by thread: Using GNU sed to delete a block of consecutive lines
- Next by thread: Re: line processing slow
- Index(es):
Relevant Pages
|
|