INSITU(1)		    General Commands Manual		     INSITU(1)



1mNAME0m
       insitu - modify files in place with shell commands

1mSYNOPSIS0m
       insitu [1m-t22m] file command

1mDESCRIPTION0m
       A  shell	 pipeline  cannot  both	 read  and write to the same file; for
       example

	 cat foo | grep bar > foo

       will merely delete the contents of foo.

       Insitu wraps  a	shell  command,	 connecting  its  standard  input  and
       standard	 output	 to  the  file.	 If 4mcommand24m finishes successfully, the
       file will be truncated (or extended) to the size of the output produced
       by  the	command.   If 4mcommand24m returns a non-zero exit status, the file
       will not be truncated (unless -t is passed),  but  contain  the	output
       read  from the command, followed by the rest of the original file.  The
       part of the file overwritten by the command output will be lost.

       Insitu runs the command with '$SHELL -c 4mcommand24m', substituting  /bin/sh
       for $SHELL if the latter is not set.

   1mOptions0m
       1m-t	22mtruncate 4mfile24m even if 4mcommand24m returns a non-zero exit status.

1mEXIT STATUS0m
       insitu  returns	the  exit  status  of  4mcommand24m.   Additionally, 1m128 22mis
       returned if invalid flags are passed, 1m129 22mif 4mfile24m cannot  be  accessed,
       and 1m130 22mif the child process for running 4mcommand24m cannot be started.

1mBUGS0m
       Insitu  is  a  dangerous	 and  brittle  tool that can easily cause data
       corruption if  the  command  fails  halfway  through.   Make  sure  you
       understand this risk before running it on important files.

1mSEE ALSO0m
       1mcp22m(1),1mmv22m(1),1msh22m(1)



				  insitu-1.0			     INSITU(1)