[SLUG] grep sed

john at johnallsopp.co.uk john at johnallsopp.co.uk
Tue Feb 28 20:22:47 GMT 2006


> On Tue, Feb 28, 2006 at 05:55:13PM GMT, John Allsopp wrote:
>> > On Tue, Feb 28, 2006 at 03:20:06PM GMT, John Allsopp wrote:
>> >> > Al said: John, I can see how you got this to work, but I'm
>> >> > uncertain about what you were trying to do with the '| tee
>> >> > out.txt' bit.  I can see how you'd use grep -l to find all the
>> >> > files containing your string before passing that list to xargs
>> >> > and doing some sed magic to change the old to new numbers.
>> Could
>> >> > you explain where 'tee' fits in please?
>> >>
>> >> I've always been irritated by the > out.txt to redirect the
>> output
>> >> to a file, whereupon you can't see what's being output. | tee
>> >> out.txt is a T junction, a stream splitter: the output goes to
>> the
>> >> file, but it also goes to stdout too.
>> >
>> > Al said: OK. Fair enough.  I guess it's just not my cup of tea!
>>
>> Well, it created a lot of output, so what else would you do?
>
> Sorry John, I'm not trying to be argumentative.

No, I know, nor me :-)

> When I do these tasks, all I do is check the file in whatever software
> it's written for or grep the strings I've changed to ensure my editing
> was successful.
>
> It seems to me that the task you described initially was finished
> after
> sed had done it's work.  The creation of another file while passing
> the
> same information to stdout seems a waste of time.

Ah, I get you. Yes, I was in the middle of working out what was going
on, though, that's all tee was there for, it was helping me debug.

This was my first experience of sed and I got a screenful of output
with no way of knowing really what it all was. Maybe it started with
something important. So I sent it to a file so I could check it
through.

So it was a learning aid really.

I was chuffed to find out about it tho, cus that had been bugging me,
so maybe I was overeager in using my new toy :-)

J




More information about the Scarborough mailing list