INPLACE(1)		FreeBSD General Commands Manual 	    INPLACE(1)

     inplace -- edits files in-place through given filter commands

     inplace [-DLfinstvz] [-b suffix] -e commandline [[-e commandline] ...]
	     [file ...]
     inplace [-DLfinstvz] [-b suffix] commandline [file ...]

     The inplace command is a utility to edit files in-place through given
     filter commands preserving the original file attributes.  Mode and owner-
     ship (user and group) are preserved by default, and time (access and mod-
     ification) by choice.

     Depending on where to make a temporary file to replace the corresponding
     original file, the inode number may change after replacement.  To prevent
     this, specify the -i option and the inode number of each edited file will
     be preserved.

     As for filter commands, a single command may be specified as the first
     argument to inplace.  Multiple commands may be specified by using the -e

     There are some cases where inplace does not replace a file, such as when:

	   1.	The original file is not writable (use -f to force editing
		against read-only files)

	   2.	A filter command fails and exits with a non-zero return code

	   3.	The resulted output is identical to the original file

	   4.	The resulted output is empty (use -z to accept empty output)

     The following command line arguments are supported:

     --help		   Show help and exit.

     --debug		   Turn on debug output.

     --dereference	   By default, inplace ignores non-regular files
			   including symlinks, but this switch makes it deref-
			   erence each symlink using realpath(3) and edit the
			   original file.

     -b SUFFIX
     --backup-suffix SUFFIX
			   Create a backup file with the given suffix for each
			   file.  Note that backup files will be written over
			   existing files, if any.

     --execute COMMANDLINE
			   Specify a filter command line to run for each file
			   in which the following placeholders can be used:

				 %0	     replaced by the original file

				 %1	     replaced by the source file path

				 %2	     replaced by the destination file

				 %%	     replaced by `%'

			   Missing %2 indicates %1 is modified destructively,
			   and missing both %1 and %2 implies ``(...) < %1 >
			   %2'' around the command line.

			   The destination file is always an empty temporary
			   file, and the source file is either the original
			   file or a temporary copy file.

			   Every temporary file has the same suffix as the
			   original file, so that file name aware programs can
			   play nicely with it.

			   Placed file paths will be properly shell escaped
			   with \'s as necessary.

			   Instead of specifying a whole command line, you can
			   use a command alias defined in a configuration
			   file, ~/.inplace.  The configuration file syntax is
			   the usual:

			   o   Each alias definition is a name/value pair sep-
			       arated with an ``='', one per line.

			   o   White spaces at the beginning or the end of a
			       line, and around assignment separators (``='')
			       are stripped off.

			   o   Lines starting with a ``#'' are ignored.

			   This option can be specified many times, and they
			   will be executed in sequence.  A file is only
			   replaced if all of them succeeds.

			   See the EXAMPLES section below for details.

     --force		   By default, inplace does not perform editing if a
			   file is not writable.  This switch makes it force
			   editing even if a file to process is read-only.

     --preserve-inode	   Make sure to preserve the inode number of each

     --dry-run		   Do not perform any destructive operation and just
			   show what would have been done.  This switch
			   implies -v.

     --same-directory	   Create a temporary file in the same directory as
			   each replaced file.	This may speed up the perfor-
			   mance when the directory in question is on a parti-
			   tion that is fast enough and the system temporary
			   directory is slow.

			   Another reason to use this switch is when the tem-
			   porary directory does not have sufficient disk
			   space for a resulted file.

			   If this option is specified, edited files will have
			   newly assigned inode numbers.  To prevent this, use
			   the -i option.

     --preserve-timestamp  Preserve the access and modification times of each

     --verbose		   Turn on verbose mode.

     --accept-empty	   By default, inplace does not replace the original
			   file when a resulted file is empty in size.	This
			   switch makes it accept empty (zero-sized) output
			   and replace the original file with it.

     o	 Sort files in-place using sort(1):

	       inplace sort file1 file2 file3

	 Below is the same thing as above, except for passing input files via
	 the command line argument:

	       inplace 'sort %1 > %2' file1 file2 file3

     o	 Perform in-place charset conversion and newline code conversion:

	       inplace -e 'iconv -f EUC-JP -t UTF-8' -e 'perl -pe "s/$/\\r/"'
	       file1 file2 file3

     o	 Process image files taking backup files:

	       inplace -b.orig 'convert -rotate 270 -resize 50%% %1 %2' *.jpg

     o	 Perform a mass MP3 tag modification without changing timestamps:

	       find mp3/Some_Artist -name '*.mp3' -print0 | xargs -0 inplace
	       -te 'mp3info -a "Some Artist" -g "Progressive Rock" %1'

	 As you see above, inplace makes a nice combo with find(1) and

     ~/.inplace  Location of the configuration file.

     TEMP    Temporary directory candidates where inplace attempts to create
	     intermediate output files, in that order.	If none is available
	     and writable, /tmp is used.  If -s is specified, they will not be

     find(1), xargs(1), realpath(3)

     Akinori MUSHA <>

     There may be.  Use at your own risk.

FreeBSD 			 April 7, 2004			       FreeBSD