The program is useful in scenarios where you cannot just add lines at the end of a file (or more generally, a particular line number), because you could conceivably end up with the lines of the file ordered incorrectly. For a file that doesn't care about order, you're probably better off with "echo foo >> /dir/file" or (in the DCS autoinstall case) using "add-line".
seki-strombrg> contextual -p must be specified exactly once usage: usage follows -p pattern specify the shell pattern, before or after which the text will be added -a perform operation after the pattern -b perform operation before the pattern -i perform an insert -r perform a removal (not yet implemented) -t text the text to add -f add text only before/after the -first- occurrence of the pattern -F filename file to operate on. Default is to read from stdin and write to stdout -d output some debugging information You must always specify both -p and -t You must always specify either -a or -b but not both You must always specify either -i or -r but not both
seki-strombrg> cat /tmp/testfile 1 2 3 foobie bletch 4 line with leading whitespace 5 6 test line with whitespace test line with tabs foobie bletch seki-strombrg> contextual -p 'foobie bletch' -f -b -i -t 'line to add with whitespace' < /tmp/testfile 1 2 3 line to add with whitespace foobie bletch 4 line with leading whitespace 5 6 test line with whitespace test line with tabs foobie bletch
You can e-mail the author with questions or comments: