uniq, join,cut and paste
uniq : remove the duplicate lines from sorted file.
syntax : uniq -u -d -c input-file output-file
-u : display the unique lines
-d : dipalsy the duplicate lines
-c : print the duplicate count
-f n : n means number, the first n characters are ignored
join : join lines of two file to a common field
syntax : join [option] input-file1 input-file2
cut:remove sections from echa line of files
paste: merge lines of files
# ls -l | paste
split : split files into pieces,or split big files to some small pieces.
Sometimes, it would be easy for us to split big files to some small pieces when we are transporting these big files. For example,when we use Vi or sort, there will be a large buffer area if edit big files. As we all know, large buffer should be avoided.That is saying, we have to split the file first.
split syntax : split -output_file_size input_filename output_filename
-output_file_size means how many lines the file will be splited. the maximum lines is 1000.
The splited pieces are named from x[aa] to x[zz], in which “x” is the firt character of the file name. [aa][zz] must be used together.for example:
# split -2 test_file
result: xaa xbb
Pay attention,”x” is always “x”,not “s” which is the first letter of the file_name.