Linux Split command
Function Description: Cut the file.
Syntax: Split [--help][--version][-< rows >][-b < bytes >][-c < bytes >][-l < lines >][files to be cut [output FILENAME] "prefix"
Additional note: Split can cut the file into smaller files, with a preset of 1000 lines cut into a small file.
Parameters
-< lines > or-l< > Specify how many lines to cut into a small file.
-b< byte > Specify how many words you want to cut into a small file. Support Unit: M,k
The -c< byte > is similar to the-B parameter, but maintains the integrity of each line as much as possible when cutting . (This is useful, especially when splitting large SQL files, if ' you '
is split into ' Yo and U ', then cat runs or is wrong.
--help display Help.
--version Displays version information.
[Output file name] Sets the file's predecessor file name after cutting, and split automatically adds a number to the pre-file name.
Examples of Use:
Split-b 100m filename
Divide the file into 100m files.
Split-b 20m gkdb.db Gkdb_pack_
Gkdb_pack_ is the prefix for each small file.
1. File cutting file Cutting mode is divided into two types: text file binary mode. 1.1 Text mode text mode applies only to text files, and each file that is cut with this pattern is readable. There are two types of text patterns: cut by the maximum file size, and cut by the number of lines of text. 1.1.1 Max file size cut Split-c 5k duanxin Split to cut the text file duanxin by the size of the maximum 5k per block, without breaking the line. Output file name is similar to Splitaa, Splitab ... split-b 5k duanxin split each tile (of course, the last one is not guaranteed) is 5k and may break the line. 1.1.2 Cut by the number of lines of text Split-l duanxin split each block 100 rows, regardless of size. Log analysis should be useful. 1.2 Binary Mode Split-b 5k duanxin split each tile (of course, the last one does not guarantee) the size is 5k, basic unreadable. This cutting mode is available for any type of file. 2. File MergingCat split* >newduanxinNo matter how it is cut, the merge method does not change. 3. Other split you can specify the length of the output file name with the-a option. If Split-l 100-a 3 duanxin Split then the output file is similar to Splitaaa,splitaab. Default is 2 when not specified. When specifying the block size with-B or-C, the available units are, B for 512bytes, K for 1Kbytes, and M for 1 megbytes.split parameters:-A,--suffix-length=n specifies the suffix of the output file name, which defaults to 2-B, --BYTES=SIZE Specifies the number of bytes in the output file-C,--line-bytes=size the maximum byte of a single row in each output,-D,--numeric-suffixes uses the number instead of the letter suffix-l,--lines=num BER number value for each output file column size grep introduction (1) grep general format for grep [options] basic Regular expression [file]
String parameters are best used in double quotes, one to prevent being misunderstood as a shell command, and two to find strings that can be used to look up multiple words
-C: Outputs only the count of matching rows
-I: Case insensitive (only for single characters)
-H: Do not display file names when querying multiple files
-H: Show only file names
-L: Only file names with matching characters are output when querying multiple files
-N: Show only matching rows and their line numbers
-S: does not display error messages that do not exist or have no matching text.
-V: Displays all lines that do not contain matching text.
(2) Illustrate:
grep ^[^210] myfile matches rows in myfile that start with a non-2, 1, 0 How to delete a file specified line: sed "P" command prints the buffer (remember to use-n option with "P")
The "D" command is just opposite, which is a for deletion. ' d ' would delete the pattern space buffer and immediately starts the next cycle. : Delete rows from line 4th to line 8th
$sed 4,8d Thegeekstuff.txt