I. Special symbols in the shellWhile you are learning Linux, you may have been exposed to a special symbol, such as "*", which is a wildcard symbol that represents 0 or more characters or numbers.Special characters that are commonly used:1, *
I wrote a JavaScript Array uniq method last time and found that the code problem still exists. For example, an undefined element in an array cannot be filtered.Yesterday I saw the Lazy brother update the function again. Now he writes it like
To be improved... sort: it is very efficient and powerful to implement the text sorting algorithm. the content of the original file is not modified. only the content output on the screen is modified. for example, sort/etc/fstab #-u removes duplicate
I. Introduction (repeat or omit repeated lines)
Check and delete duplicate rows in a text file (definition of duplicate rows:Completely matched continuous rows).
Ii. Format
Uniq [Option]... [input [Output]
Iii. Common options
-C adds the number of times each line appears in the input file before the output line.-D displays only duplicate rows. -U displays only rows that are not duplicates.Example1, go to heavy, there are many lines of the same display only one lineCat
SED command1, sed-n ' 2 ' p filePrints only the second line of file files.2, Sed-n ' 1,4 ' p fileOnly the records from the first row to the fourth line are printed.3, Sed-n '/los/' p filePrints a row that matches Los.4, Sed-n ' 4,/los/' p filePrints
Transferred from: http://10495845.blog.51cto.com/10485845/1671771A Sorting text sort1.sort sorting is done based on the comparison of one or more keywords drawn from the input line. The sort key defines the smallest sequence of characters used to
Sort is used for sorting, and the uniq is used to de-weigh, and these two commands are often used together. Mainly because the Uniq to the premise that the text must be arranged in order to be.Of course, it is true that these two commands are indeed
Shell Special Symbol Cut commandShell Special Symbols* *任意个任意字符* ?任意一个字符* #注释字符* \脱义字符* |管道符Command cutcut is used to intercept a field in the form of: #cut –d ' separator character ' [-cf]n,n is a number.Options:- D is followed by a delimiter, and
Sort commandSorts the rows in the files specified by the file parameter and writes the results to standard output. If the file parameter specifies multiple files, the sort command connects the files and sorts them as a file.Options and Parameters:-F:
Linux displays duplicate lines of uniq-general Linux technology-Linux technology and application information. The following is a detailed description. Uniq [Option] File
Note: This command reads the input file and compares adjacent lines. Under
Recently, the linux commands grep, awk, cut, uniq, wc are used to calculate the number of players who use commands every day. comgzip-c-dnohup.out. 'date + % Y % m % d '*. gz | grep/web/api/logic/logicDispatcher | awk & amp; #39; {FS & quot; &
Text Processing commands:Cut ,sort ,WC ,uniqCut Select a paragraph in a piece of information, and the information is processed in "Rows". syntax:cut OPTION ... [FILE] ...Parameters:–d ' separators '–f # Segmentation by character, showing section
1. WC: number of bytes, words, and lines of statistics filesformat: WC [OPTION] ... [FILE] ...Wc[option] ...--files0-from=fParameters:- C : Count bytes- M : Statistics of characters- L : Count Rows- W : Counting Words Example:[Email protected] ~]#
The Linux uniq command is used to check and delete duplicate rows in a text file.Uniq can check for repeated rows and columns in a text file.GrammarUniq [-cdu][-f][-s][-w][--help][--version][input file [output file]Parameters :-C or--count displays
First, cut toolsThe 1.cut tool is responsible for cutting data in a file, acting on one object, and at this point the same processing mechanism as the tool sed.2.cut usage, the cut command mainly accepts three of the method:(1) Cut by byte, use
The uniq command can only remove repeated items.
Test text
[shuohai.lhl@v035114 bin]$ cat test 711[10.235.170.22:8123] 0 10.232.20.178 1648042 1648042 0 2013-07-29 20:01:35 711[10.235.170.22:8123] 11
1. Remove the set of two files (duplicate lines are reserved only one copy)2. Remove the intersection of two files (leaving only files that exist in two files)3. Delete the intersection and leave the other rows1. Cat File1 file2 | Sort | Uniq2. Cat
Most of the time, we are going to calculate the total number of identical patterns in the data, for example, using last can be used to find the identity of the landing host this month. Can I find out their total number of landings for each user? At
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.