Linux awk Command SummaryBrief introduction:awk is a powerful text analysis tool, with the search for grep and the editing of SED, which is especially powerful when it comes to analyzing data and generating reports. to put it simply, awk reads the file line-by-row, using spaces as the default delimiter to slice each row, and then perform various analytical processing of the cut. 1. Command line mode
-Group Mail2Findfiles in the USR directory that are not root, bin, Qhdlink, and other users; Useradd QhdlinkFind/usr-not \ (-user root-a-user bin-a-user qhdlink \)3Findthe files that have been modified in the last week in the ETC directory and are not owned by the root and student users;Find/etc-mtime-7-a-not-user root-a-not-User Student4) Find files on the current system that are not owned by the master or group and have been accessed in the last 1 days, and change their genus to root;Find/-nou
Introduction to 1.awk Commands:Awk is a very powerful language that can handle data and produce formatted reports.The way awk works is to read data, treat each row of data as a record (record) each record is divided into fields with field separators, and then output the values for each field.2.awk Common function formats:awk "Style" file: Displays data rows that
Awk must be known to anyone who has experience processing too much text. It is a scripting language that is easy to use to process data in a certain format. The following describes common methods of awk.
If you want to learn systematically, see http://doc.lazyhack.net/awk.htm
1 awk built-in Variables
The built-in field variables of
First put a picture, this is the end of the road book display effect
1, demand--2, solutions--3, implementation Method--4, subsequent expansion
1. Demand
Demand is probably like, to achieve the progress of the book play, you can forward back, pause, when the mouse hover trolley display location information (callout)
Subsequent (playback speed modification)
2, solve the idea
The original idea: I threw a bu
Today, according to teacher Ke's book, we experimented with an example of a very simple differential service network.This is the network structure, very simple, nodes 0 and 1 to generate CBR traffic 2 and 3 is the Edge server, 4 is the core node, 5 is the destination node.Flow is this: First data flow into the edge router, at this time by its rate is classified, here Choose tsw3cm method, divided into green, yellow, red three categories to mark the pa
awk ProgrammingAwk is a programming language. Gawk, is the latest version, the current Linux version is used Gawkawk is a soft link to gawkhow awk works BEGIN #在未读取文件行之前执行Primary input loop, which executes repeatedly until the terminating condition triggersEND #在读取文件行完毕后执行three ways to call awk1. Invoking awk on the shell command line Input command#
I. Directly process awk COMMANDS IN SHELL
Awk '{print $0}' file
Awk '/^ (11 + ?) \ 1 + $/{print $0} 'file // The famous regular that determines whether it is a prime number
The preceding two commands are commands that can be directly executed in shell. The basic mode is awk pattern {action} file, which means that
) Capitalize the first lowercase letter of each word[[Email protected] sed]# sed ' s/\b[a-z]/\u/g ' test.txt3.sed the last number in a row of a file[email protected] sed]# cat Test.txtErtFff**[ABCFD]123324444[Rty]**Fgfgf[[Email protected] sed]# sed ' s/\ (^[0-9].*\)/\1 12/' Test.txt4. How to use SED to print rows from 1 to 100 lines containing a string[email protected] sed]# cat Test.txtErtFff**[ABCFD]123324444[Rty]**FgfgfAnswer: [[email protected] sed]# sed-n ' 1,100{/fd/p} ' test.txtFff[ABCFD]
Introduction:
Grep, sed, and awk are three mainstream text processors, but they have their own advantages and disadvantages in processing. Here we will only introduce awk
Awk is an excellent text processing tool. It is not only one of the most powerful Data Processing engines in Linux, but also in any environment. The maximum functionality of this programming a
Awk data input has two sources: standard input and file. The latter method supports multiple files.
For example:1. shell Pathname Expansion mode: awk '{...}' *. txt
# *. Txt is first interpreted by shell and replaced with all *. txt files in the current directory,# If 1.txtand 2.txt are recorded in the preceding directory, the command is awk '{...}' 1.txt 2.txt
2
Http://www.cnblogs.com/chenhuan001/p/6297615.html
From this small usage, use awk to randomly extract n rows from a file
Brief introduction
Awk is a powerful text analysis tool that is particularly powerful when it comes to analyzing and generating reports on data, compared to grep lookup and sed editing. To put it simply, awk reads the file line by row, using
\+\)/[--\1--] [\2]/g ' list[--line--] [200]Line3 100Line4 100Line5 700Line5 800Line6 50Line7 350multiple sed combinations,[Email protected]:~# sed ' s/\ (\w\+\) 2\ (\w\+\)/[--\1--] [\2]/g ' list | sed ' s/line7/tttt/g '[--line--] [200]Line3 100Line4 100Line5 700Line5 800Line6 50TTTT 350AwkAwk is so powerful that I'm not listed here for space reasons, and I can see an article and a comment that I sent earlier.http://atong.blog.51cto.com/2393905/1343553There is also the time to look at the
Outline: Color: awk Basic Use ##################################################### One, color: Shell, set the output text color (foreground color, background colors) In the shell, you can set the color of the output font (foreground, background color)
Color
Black
Red
Green
Yellow
Blue
Purple
Blue
White
Font encoding
30
31
32
33
34
35
36
37
Variables in awk
Combined with sed, awk provides almost all-around horizontal and vertical file processing, which can be regarded as a big move in text processing. Of course, awk's powerful sub-processing tool is not a waste of names, features are rich, and the learning cycle is longer. It can be completed without a Help document. Learning awk can be considered r
GNU awk:Text Processing three tools: grep, sed, awkgrep, Egrep, Fgrep: Text filtering tool; patternSed: line EditorPattern space, hold spaceawk: Report Generator, formatted text output;Awk:aho, Weinberger, Kernighan---New AWK, NawkGNU awk, GawkGawk-pattern scanning and processing languageBasic usage: gawk [options] ' program ' FILE ...Program:pattern{action statements}The statements are separated by semicol
First, awksed processes files in a behavioral unit, and awk can not only process files in units of behavior but also in columns. The default line delimiter for awk is a newline character, the default column separator is contiguous space and tab, and the row and column delimiters can be redefined, such as/ect/passwd files with several fields in each row: delimited, then redefine the delimiter for
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.