INSITU(1) General Commands Manual INSITU(1) NAME insitu - modify files in place with shell commands SYNOPSIS insitu [-t] file command DESCRIPTION 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 command finishes successfully, the file will be truncated (or extended) to the size of the output produced by the command. If command 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 command', substituting /bin/sh for $SHELL if the latter is not set. Options -t truncate file even if command returns a non-zero exit status. EXIT STATUS insitu returns the exit status of command. Additionally, 128 is returned if invalid flags are passed, 129 if file cannot be accessed, and 130 if the child process for running command cannot be started. BUGS 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. SEE ALSO cp(1),mv(1),sh(1) insitu-1.0 INSITU(1)