How to do <cmd> file | hold file

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Sun Sep 9 13:14:39 AEST 1990


In article <1990Sep8.054623.3822 at sj.ate.slb.com> fabrice at sj.ate.slb.com writes:
> I use the following C-shell alias to get the output of a command into
> the file it applies to. The command should be of the form "<cmd line> <file>".
> 	alias apply  \!\* \> /tmp/apply.\$\$ \; cp /tmp/apply.\$\$ \!\$

Much better is

  % alias transform '(rm \!:1;\!:2* > \!:1) < \!:1'

which is used as, e.g., % transform foo.c grep -v '^/\*###' to strip
comments inserted by error(1). It doesn't demand a temporary file. It
can release the disk space of the original as soon as the command closes
it. And it doesn't pass foo.c as an argument if the command is just a
filter.

---Dan



More information about the Comp.unix.shell mailing list