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; amp
Recently learned linux commands grep, awk, cut, uniq,
Recently learned linux commands grep, awk, cut, uniq, wc. The actual application example shows the number of players who use commands every day: www.2cto.com gzip-c-d nohup. out. 'date + % Y % m % d '*. gz | grep/web/api/logic/logicDispatcher | awk '{FS = ""; print $2 ;}' | awk' {FS = "= "; print $2;} '| cut-d ''-f3 | cut-d'/'-f2 | sort | uniq |
GrepThe grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and match lines to print.Command syntax:Usage:grep [-ABCDEFGHHIIJLLMNOOQRSSUVVWXZ] [-A num] [-b num] [-c[num][-E Pattern] [-F file] [--binary-files=value] [--color=when][--context[=num]] [--directories=action] [--label] [--line-buffered][--null] [Pattern] [File ...]Command instance:-C: Calculates the number of rows to match and displa
number of duplicate items. Therefore, you need to combine the sorted files for processing.
• WC
If I want to know how many words are in the/etc/man. config file? How many rows? How many characters can be used? In fact, we can use the WC command to achieve this! He can help us calculate the overall data of the output message![Root @ Linux ~] # WC [-LWM]Parameters
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 cut is as follows:
Cut-D 'separator '-F Fields
Cut-C character range
Parameter description:-
http://www.vaikan.com/use-multiple-cpu-cores-with-your-linux-commands/Have you ever had to calculate a very large data (hundreds of GB) requirement? Or search inside, or anything else--something that can't be done in parallel. Data experts, I'm talking to you. You may have a 4-core or more core CPU, but our appropriate tools, such as grep, bzip2, WC, awk, sed , and so on, are single-threaded, Only one CPU c
Have you ever had to calculate a very large data (hundreds of GB) requirement? Or search inside, or anything else--something that can't be done in parallel. Data experts, I'm talking to you. You may have a 4-core or more core CPU, but our appropriate tools, such as grep, bzip2, WC, awk, sed, and so on, are single-threaded and can only use one CPU core.Borrowing cartoon characters Cartman words, "How can I u
Content directory: Find file lookup grep text Search xargs command line parameter conversion sort sort Uniq eliminate duplicate rows with TR convert cut by column split text paste by column stitching text WC statistic lines and characters tool sed text substitution benefits The lines, words, and characters in the iteration file for the AWK Data flow processing tool
This article describes the most commonly u
: number begins with a number endinggrep ' \ ([0-9]\). *\1$ '/etc/inittabTo match any single character of a class [[:d igit:]],[[:lower:]],[[:upper:]],[[:p unct:]],[[:space:]],[[:alpha:]],[[:alnum:]]Second, grep (Global Search), sort (text statistics),Cut (text Cut tool),WC (text statistics), TR (character processing command), Uniq (display repeating line, adjacent + same = repeat)
The grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching lines. The grep full name is global Regular expression Print, which represents the globally regular expression version, and its use rights are for all users.Wc1. Command format: WC [options] File ... 2. Command function: Statistics
Have you ever had the need to calculate a very large data (several hundred GB? Or search in it, or other operations-some operations that cannot be performed in parallel. Data Experts, I am talking to you. You may have a 4-core or more multi-core CPU, but our appropriate tool, suchGrep,Bzip2,Wc,Awk,SedAnd so on. They are all single-threaded and can only use one CPU core."How can I use these kernels "?To allow Linux commands to use all the CPU cores, we
command to view the number of time_wait connections netstat-ae|grep "time_wait" |wc-l the morning log in to the server when entering Netstat-an|grep
MySQL Found a large number of time_wait states connected tcp 0 0 127.0.0.1:3306 127.0.0.1:41378 time_wait tcp 0 0 127.0.0.1:3306 127.0.0.1:41379 time_wait tcp 0 0 127.0.0.1:3306 127.0.0.1:39352 time_wait tcp 0
Keyword-based search
grep keyword file parameters:
-I ignores case
-N Displays the results in rows
-V output lines with no keywords
-an the specified number of rows after the line is output at the same time
-BN the specified number of rows before the row is output at the same time
Working with text based on columns
Cut-and
-D Specify Separator
-F Specify column number
-CN1-N2 the N1-N2 column based on character segmentation
Text Statistic command
|headThe begin {Command} End{command} structure in awk, specifying the operation of the head and tail, different from the general begin END block structureSpecial meta characters in awk: +,? + Match all,? Match a single characterMatch operator: ~,!~//~ match,!~ mismatchHead messages |awk ' $ ~/21:59/' matches 21:59 rows, which is equivalent to the grep feature, but awk can more precisely control the specific domain.Head messages |awk ' $!~/21:59/' do
Tags: document echo shel Sublime expr common appear lob imageThe grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching lines. grep full name is global Regular ExprEssion Print, which represents the global regular expression version, whose usage rights are all users.Wc1. Command format: WC
, simply followed by a wc-l pipe command:Cat WC -LQuestion 2, found that an external network interface is slow, how to see the interface is slow where there are?grep " api.weixin.qq.com/cgi-bin/ " grep " api.weixin.qq.com " awk ' $6 > 5 ' Less #grep -
ls | Wc-l and Ls-l | The difference between wc-lNote: My execution Environment is UNIXExecute LS, the result is as followsExecute ls-l, the results are as followsExecute ls|wc-l, the results are as followsExecution of the ls-l|wc-l, the results are as follows from the above performance can be seen, ls|
Grep command Chinese manual (info grep translation), grep Chinese manual
1. This article is the info man translation, which is basically translated according to the original text. There are several unavailable options that are not translated, but the original text is given for the integrity of the article.2. Some "(note:") in the Translation. You can add it for y
??BytesBytesBytesOK.Bytes~~~
Then:
WC abc.txt
6 5 28 abc.txt
Six lines, five words, and 28 characters. Let's count it.
There are 6 lines including invisible carriage returns;
There are five consecutive letters separated by no-null characters:You,Are,Nice.,Right ??,OK.
Bytes (or characters) contain a total of 28 carriage returns.
Example:
Example1: how to count the number of files in a directory and the total number of lines of code in Linux
Co
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.