Adding to the front of a line

David Fox dfox94085 at
Wed Jan 21 07:11:44 UTC 2009

On Tue, Jan 20, 2009 at 10:43 PM, Matthew Flaschen
<matthew.flaschen at> wrote:
> In other words, the sequence is used as input, but not timed.

I see. Well, in that case, the difference between using a while read
vs a sed is dramatic:

dfox at ubuntu:~$ time (while read lines; do echo " " $lines;
done) <lines >newlines

real	0m37.781s
user	0m29.542s
sys	0m7.732s
dfox at ubuntu:~$ time (sed 's/^/ /' <lines >newlines)

real	0m1.754s
user	0m1.636s
sys	0m0.108s

More information about the ubuntu-users mailing list