-->
Previous | Table of Contents | Next |
csplit......Split Files
csplit option(s) file arguments
PURPOSE
The csplit command splits a long file into two or more smaller files. You can tell csplit to split files based on size or by content, using specific expressions as markers for splitting. The original file will be unchanged.
The new files will begin with xx. The first file is xx00 (remember, Linux likes to begin everything with 0), the next file is xx01, and so on. Theres a limit of 100 files, so the highest filename numerically is xx99.
OPTIONS
-f txt | Uses txt instead of xx to begin the new filenames. |
-k | Keeps files even if the command line fails. |
-n num | Uses numbers that are num characters long in filenames, instead of two, the default. |
-q | Suppresses character counts. |
-s | Suppresses character counts. |
-z | Doesnt create empty files, but does maintain numbering. |
ARGUMENTS
|expr| | Creates a file that begins with a current line to the line containing expr. You can add a suffix that ends a file num lines before or after expreither +num or -num. |
%expr% | Creates a file that begins with expr. You can add a suffix that ends a file num lines before or after expreither +num or -num. |
line | Creates a file at the current line and ends one line before line. |
{n} | Repeats an argument n number of lines. The default is to repeat an argument once. |
EXAMPLE
$ csplit -k bonfire /Chapter/ {20}
This splits a file named bonfire into 20 chapters, each beginning with Chapter.
cut......Cut Columns
cut option(s) files
PURPOSE
The cut command cuts columns or fields from a file or set of files and displays them. You can use the information to view parts of a file, or else you can take the information and send it to another new file.
OPTIONS
-c list | Cuts columns specified in list. |
-d character | Specifies delimiter for determining columns or fields; the default is a tab. If a nonalphanumeric character is used (such as a space), then it must be enclosed in single quote marks. This option must be used with the -f option. |
-f list | Cuts fields specified in list. |
-s | Suppresses lines without a delimiter; used with the -f option. |
EXAMPLE
$ cut -f1,4 payroll
This cuts the first and fourth fields from the file payroll and displays them on the screen.
$ cut -c1,4 payroll > payroll.old
This cuts the first and fourth columns from the file payroll and places then in a new file entitled payroll.old.
RELATED COMMANDS
diff......List Differences in Files
diff option(s) diroptions file1 file2
PURPOSE
The diff command compares two files and returns the lines that differ. The line numbers of the differing files are marked with the < and > symbols: The differing line from file1 is marked with < and the differing line from file2 is marked with >. Three hyphens (---) separate the contents of the files.
The diff command can also be used to compare files in different directories. In this situation, use diroptions.
This command works best with smaller text files.
OPTIONS
-a | Compares all files, including binary files. |
-b | Ignores blanks at the end of a line. |
-B | Ignores blank lines within the files. |
-c | Prints three lines of context for each difference. |
-d | Speeds processing by ignoring areas with many changes. |
-e | Returns commands to recreate file2 from file1 using the ed text editor. |
-H | Scans for scattered small changes; will miss out on many other changes. |
-i | Ignores the case when comparing files. |
-I expr | Ignores file lines that match expr. |
-n | Returns information in RCS diff format. |
-N | Treats nonexistent files as empty. |
-t | Expands tabs to spaces in output. |
-T | Inserts tabs at the beginning of lines. |
-u | Prints old and new versions of a file as a single line. |
-w | Ignores tabs and spaces (white space). |
-y | Returns information in two columns. |
DIROPTIONS
-l | Paginates the output to pr. |
-r | Recursively runs diff to look at files in common subdirectories. |
-s | Returns identical files. |
-Sfile | Begins with file when comparing directories, ignoring files alphabetically listed before file. |
-x expr | Ignores files that match expr; wildcards cannot be used. |
-X filename | Ignores files that match expr; wildcards can be used. |
EXAMPLE
$ diff letter.1212 letter 1213 1c1 < December 12, 1997 - - - > December 13, 1997 ...
RELATED COMMANDS
Previous | Table of Contents | Next |