): Indicates that the second field of each row is printed from right to left.[Email protected]]# awk ' {print $ (NF-2)} ' Awk.txt [28/sep/2010:04:20:11]304begin{} zone indicates usage:The function of 1.OFS is to store the delimiter of the output field[Email protected]~]# awk-f: ' begin{ofs= + + + '}/^www/{print $, $ $, $ $, $4, $ "/etc/passwd www+++x+++500+++500 +++# with ":" As the delimiter, + + + fo
default, awk takes a space as a delimiter for a field.AWK basic command Format awk [f FS] [-v var=value] [-F prog-file | ' Program test ' [File ...] Where the-f parameter is used to pre-specify the segment delimiter mentioned earlier. -V is used to pre-specify variables for the awk program. The-f parameter is used to specify the program file to be executed by the awk command, or to simply place the program statement here without the-f parameter. Finally, for awk to process text input, you can e
(10); the printed content occupies a total of 10 characters and is right aligned.Effective only for one cout behind it(5) cout. Fill ('#'); fill the space '#'It is called once and will take effect for future calls.(6) SETF () operation, control format, teaching material page 1(7) special characters'\ R' indicates to roll back a grid and then output'\ N' press ENTER\ Outputs a '\' because '\' is considered an escape character'\ T' a tab key(8) Output ControllerOct outputs "0" by octal"Decimal ou
""
Print NR, "records processed ."}
This program modifies the default field separator and prints the total number of records using NR. Note that this program uses a regular expression. The output result of program execution is as follows:$ Awk-F,-f phonelist. awk names
John Robinson, 696-0987
Phyllis Chapman, 879-0900
2 records processed.
When the parameters are separated by commas in the print statement, the output field separator (OFS) is generate
Use sed and awk to obtain the latest DataNode information of the cluster, awkdatanode
Due to the poor remote desktop, when the cluster has missing block, you cannot log on to the Remote Desktop to view the nodes that have crashed the DataNode process due to restart. At the same time, it is inconvenient to simply use the command hdfs dfsadmin-report to view the information, and there is too much information. The following is a simple script implemented with sed and awk:
Cat lastDeadNodes. sh
Hdfs
current file.
Fs
The field delimiter (the default is any space).
IGNORECASE
If true, the matching of the case is ignored.
Nf
The number of fields in the current record.
Nr
The current number of records.
Ofmt
The output format of the number (the default value is%.6g).
OFS
The Output field delimiter (the default value is a space).
program, -f to specify awk the program files to be executed by the command, or -f to parameters, the program statements are placed directly here, and finally the awk text input that needs to be processed, and multiple text files can be entered at the same time. Now let's go straight to the concrete experience.4.awk Operation ExperienceCreate a new text document with Vim firsttestContains the following content:I like linuxwww.shiyanlou.com
Use awk to print text content to a terminal
the elevator with you may be a friend of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you have died so quickly.14. Is your desk professional?At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything you want, but
your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you have died so quickly.
14. Is your desk professional?At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything you want, but please note, the
desk professional?At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything you want, but please note, the desk is also a place that shows your value, so you need to make your desk professional.
What kind of
company elevator, the person who takes the elevator with you may be a friend of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you died so quickly.
14. Is your desk professional?
At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and
elevator, the person who takes the elevator with you may be a friend of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you died so quickly.
14. Is your desk professional?
At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can
The so-called compound, is the definition of the members of this class is another class of instance methods.That is, the other objects as part of their own, to enhance their own functions,is equivalent to a function nesting in the C language. Here is a piece of code (multiple files are put together):1 /*Declaration of the **computer class ***computer declaration of Class ***computer * **/2 #import3 4 @interfaceComputer:nsobject5 6@property (nonatomic, strong) NSString *brand;//declaring a String
friend of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you have died so quickly. 14. Is your desk professional? At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything you want, but please note, the
who takes the elevator with you may be a friend of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you have died so quickly. 14. Is your desk professional? At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything yo
of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you died so quickly.
14. Is your desk professional?
At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything you want, but please note, the
with you may be a friend of your boss, an important customer. You can praise the company, but do not say anything that is opposed or dissatisfied in the elevator. Otherwise, you will not know why you died so quickly.
14. Is your desk professional?
At present, most foreign companies use a small grid of desks. Maybe you think my desk is a private place, and you can put anything you want, but please note, the
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service