[TAG] More on filtering in-place
Jason Creighton
androflux at softhome.net
Thu Apr 15 02:31:42 MSD 2004
On Wed, 14 Apr 2004 20:42:59 +0100,
Geoff Clare <lgtag20040414 at gclare.org.uk> wrote:
> I read through your discussion of filtering in-place in issue #101
> and was surprised that nobody mentioned this method:
>
> filter < file 1<> file
Hmm, Look at this:
``
/tmp$ ls -1 / | tee file
bin
boot
cdrom
dev
etc
floppy
home
lib
mnt
opt
proc
root
sbin
tmp
usr
var
/tmp$ grep b < file 1<> file
/tmp$ cat file
bin
boot
lib
sbin
etc
floppy
home
lib
mnt
opt
proc
root
sbin
tmp
usr
var
/tmp$
''
What's happened here is that the output from the filter is not as big as
the file itself, so there's "leftover" data hanging around if you're
(for example) removing things from the file. This could cause problems
in some cases.
But I'm curious: How does this work at all? What, exactly, does
``
/tmp$ grep b < file 1<> file
''
tell the shell?
Jason Creighton
More information about the TAG
mailing list