Adding to the front of a line

Matthew Flaschen matthew.flaschen at gatech.edu
Wed Jan 21 06:49:06 UTC 2009


Matthew Flaschen wrote:
> David Fox wrote:
>> On Tue, Jan 20, 2009 at 3:37 AM, Florian Diesch <diesch at spamfence.net> wrote:
>>> Using "seq 1 1000000 " as input the shell codes needs about 18s here
>>> while sed needs about 7s.
>>
>> I'm not sure that is a fair test. Sure, bash is interpreted, but how
>> much "interpretation" really is done by a simple 'seq 1 1000000'?
>> Probably not a whole lot, compared to something like a for/next loop
>> in the old interpreted Basic machines.
> 
> I don't think that's what Florian meant, and it's not what I did.  I did:
> 
> seq 1 1000000>sites.txt
> time (while read site; do echo "127.0.0.1 $site"; done <sites.txt
>> output_file.txt)

The end of that line should read: done < sites.txt > output_file.txt)

Matt Flaschen




More information about the ubuntu-users mailing list