grep should be a search tool that all Linux developers use every day, with its easy-to-use, powerful win large majority of people's favorite, skilled use of grep can greatly improve the efficiency of the tool, the following summarizes my work in the use of some skills.First, basic usagegrep [Options] PATTERN [FILE ...]The common options are several:-A search in t
| Sort | Uniq-c 1 reboot- root 1 wtmpUNIQ This command is used to delete duplicate rows only show one, for example, you want to know the user who landed your console this month, and do not care about his number of landing, then use the above example, (1) All the data is listed first, (2) The name of the person separately, (3) sorted; (4) Show only one! Because this command is to reduce the duplication of things, of course, you need to "match the sorted files" to deal with it!
" Introduction "grep: A powerful text-search tool that uses regular expressions to search for text and print matching lines"Grep common usage"[[email protected] ~]# grep [-ACINV] [--color=auto] ' search string ' filenameOptions and Parameters:-A: binary files are searched for data in the form of a text file-C: Calculates the number of ' search string ' found-I: I
size of a mesage queue +KERNEL.MSGMNB =65536 - the# Controls The maximum size of a message,inchbytes *Kernel.msgmax =65536 $ Panax Notoginseng# Controls The maximum shared segment size,inchbytes -Kernel.shmmax =68719476736 the +# Controls The maximum number of shared memory segments,inchpages AKernel.shmall =4294967296 the[Email protected] zkero]#grep-V'^$'/etc/SYSC +sysconfig/sysctl.conf -[email protected] zkero]#
grep, which finds the meaning of a string, is to match a qualifying string in a file.1. Command format:...2. Common options:"Grep-c"Statistics Match to' String 'The number of rows for the content. (c is the meaning of count)"Grep-i"ignores case differences. (I for the meaning of ignore)"Grep-l"Print out matches to' Str
consumed, and whether there are large files.
3. data processing
3.1 Search Data grep
The PS command is described in the previous section when viewing the process with the grep command mentioned. The following shows the MySQL error log file to find information that contains warning keywords.
Use the GREP-C parameter to display the number of match
Linux under grep displays multiple lines of information
The grep under standard Unix/linux controls the context through the following parameters
Grep-c 5 Foo file displays the line in the file matching the Foo string and the top and bottom 5 lines
grep lookup contains specific characters in the specified directory
Instance
Search all files in the/var/www/html directory, with files containing phpinfo characters, and show travel numbers
Grep-rn phpinfo/var/www/html/*
Note:-R is recursive meaning-N to display line numbers
grep searches for a specific file in a
Linux diary: Cut grep sort WC uniq
After several days, I finally had time to write a Linux blog. Recently I felt a lot of emotion, but I was unable to give up my love for Linux. So I continued my research and didn't want to delay my step forward due to chores, I am literature and art.Cut command.
The basic usage of cu
path name9 find the number between 1-255 in the ifconfig command resultIfconfig | Egrep "\10 Challenge: Write a pattern to match a reasonable IP address11 Challenge: Write a pattern to match all email addressesBecause the specific e-mail address rules are unknown, so the following is written by themselves, feel goodEgrep--color=auto "^[[:alnum:]]+ (_?[ [: Alnum:]] +) {0,}@ ([[: Alnum:]]+\.) {0,} [[: alnum:]]+$] Matchmail.regexpThis article is from the "Ops Dog" blog, make sure to keep this sour
This technique comes from my actual development:Inet_addr This function is used to turn the IP address into a network byte order, his prototype: in_addr_t inet_addr (const char *CP);The return value is a in_addr_t type, it is clear that this is not a C language standard data type, want to figure out what he is exactly what type, certainly to find the header file, on the Linux system, the header file is generally placed under/usr/include, but this very
Linux Command grep, linuxgrep
Execution permission: All Users
Location:/bin/grep
Syntax: grep [options] pattern [file...]
Function: Search for string-matched rows in the file and Output
Option: invE
-N: Output row number
Grep-n "csdn" regex.txt matches the line contai
find the line matching the specified string from the file contents: $grep "the string being searched for"The file name looks for the line that matches the regular expression from the contents of the files: $grep–e "Regular expression" file name lookup when case-insensitive: $grep–i"the string being searched for"file name lookup matches the number of lines: $
Friendly tip: Linux command operations are case-sensitive!Grep's Full English name: Global search REgular expression and Print out of the line.The text content search tool searches the target file on a row-by-line basis based on user-specified text patterns (regular expression metacharacters and normal characters) to display rows that can be matched.Introduction to How to use:grep [OPTIONS] PATTERN [FILE ...]Example:
Regular expressions I wrote the blog for the first time. The basic use of regular expressions has just been learned recently. Organized, and later used to review the search. The basic description of regular expressions:Basically, a regular expression is a pattern used to describe a certain amount of text, and the shorthand for regular expressions is the Regex full name regular Express.The first regular expression is very important for Linux OPS engine
In Linux, the RM + grep command deletes all files except the specified file. Previous/next article 10:17:38/personal classification: liunx (185)/comment (0)/score (0/0) this afternoon, I was asked how to delete all the files in a directory except the desired files. I thought about whether grep and RM work properly. After reading the information, we came up with a
YOUARERINGT4. The end of this is with the. End so does not match to4 YOUARERINGT4 is matched here, ending with the number 4 that appears earlier5,he is 2tom2 here, which ends with the number 2 that appears earlier5,he is 2tom2. The end of this is with the. End so does not match to6 Tom is Cat4,yes is 4. The end of this is with the. End so does not match to7 eg is over 11. The end of this is with the. End so does not match to7 eg is over 11 matches here, is ending with the number 1 that appears
http://mtnt2008.iteye.com/blog/710452
Add color to the grep command under Linux
Java code grep--color "test" Test.json
grep--color "Test" Test.json
Automatically color grep
Java code vim ~/.BASHRC alias grep= '
character that matches the pattern \3... He loves his lover. He likes his lover. She likes ker liker. She loves her liker ~] #grep "\ (L.. e). *\1 "Lovers.txtBack reference: The character that references the pattern of the preceding grouping brackets to:Example:1. Displays the lines in the/etc/passwd file that do not end with/bin/bash:~] #grep-V "Bin/bash"/etc/passwd2. Find the two-digit or three-digit num
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.