[aklug] Re: Tip of the Day

From: Shane Spencer <shane@bogomip.com>
Date: Sat Mar 27 2010 - 08:54:28 AKDT

On Sat, Mar 27, 2010 at 8:32 AM, Kenneth D Weinert
<kenw@quarter-flash.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Christopher Howard wrote:
>> Never pipe the output of your sed command straight back into the files
>> you are processing. You lose a lot of source code that way. :]
>
> Ah, grasshopper - you have firmly grasped the pebble that has been
> grasped by many before you :)
>
> And yes, this *is* the voice of experience talking. Not something I've
> done in quite a while now, but the memory is still fresh.
>

I have a fun comment to this:

I've done this a few times forgetting that the pipe/redirect is
brought up before the commands that feed them, which is why that file
suddenly doesn't have data. However append redirect is your buddy
when you want to try to "sneak one" past the shell. TAKE THAT! - oh..
and for larger files.. say more than 1k.. this will be an endless loop
of pain.

  sed 's/this/that/g' infile >> infile
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat Mar 27 08:54:39 2010

This archive was generated by hypermail 2.1.8 : Sat Mar 27 2010 - 08:54:39 AKDT