Adding to the front of a line

Matthew Flaschen matthew.flaschen at
Tue Jan 20 18:27:24 UTC 2009

Florian Diesch wrote:
> Matthew Flaschen <matthew.flaschen at> wrote:
>> Cameron Hutchison wrote:
>>> If the file is not very big, looping in bash will work ok, but once you
>>> start dealing with larger files, you really want to use other tools than
>>> bash loops. 
>> I doubt you'll get any noticeable performance difference.  The bash
>> script I gave does not fork any external processes.
> But shell code is interpreted while sed is native code.
> Using "seq 1 1000000 " as input the shell codes needs about 18s here
> while sed needs about 7s.

You're right.  I tested and the difference on my machine was far more
than I expected too.

Matt Flaschen

More information about the ubuntu-users mailing list