Protocols‎ > ‎


Looks inside files for a defined word. For example
    grep DOCKED dock.dlg
will look inside dock.dlg for any line with DOCKED anywhere in it, and output the whole lot.
    grep '^DOCKED' dock.dlg
The ^ (caret) adds the requirement that the line must start with the word DOCKED.

This extracts parts of a line in a text document.
    cut -c 20-
will cut out everything before the 20th character, and return everything after it
    cut -c -30
will cut out everthing after the 30th character, and return everything before it
    cut -c 20-30
will report only characters 20-30

The csplit command copies the specified file and separates the copy into segments. The original input file, which remains unaltered, must be a text file.

csplit [ -f Prefix ] [ -k ] [ -n Number ] [ -s ] File Argument ...

-f Prefix Specifies the prefix to be used for the created file segments. The default value for this variable is xx.
-k Leaves created file segments intact in the event of an error.
-n Number Changes the number of decimal places used in the created file names. The default is two decimal places, or xx00 . . . xx99. If you specify the -n 4 flag, for example, new files are named xx0000 . . . xx0099.
-s Suppresses the display of character counts.

csplit -f chap