Grammar
The code is as follows
Copy Code
Case value when [compare-value] THEN result [when [compare-value] THEN result ...] [ELSE result] When [condition] THEN result [when [condition] THEN result ...] [ELSE result] End
Instance
The code is as follows
Copy Code
SELECT case when 10*2=30 THEN ' correct 'When 10*2=40 THEN ' correct 'ELSE ' Should be 10*2=20 'End;
Complex point
The code is as follows
Cop
the file currently being processed
awk ' {if (argind==1) {print} if (argind==2) {print $} ' aaa.txt bbb.txt # scan AAA file First, then scan BBB file
The number of records that NR has read out
awk ' Nr==1,nr==5{print} ' Aaa.txt # displays 1 to 5 lines of aaa.txt files
FNR the number of records in the current file
awk '
an adult.' -> WHEN 'X' THEN 'No one 17 and under.' -> WHEN 'NR' THEN 'Use discretion when renting.' -> ELSE 'OK to rent to minors.' -> END AS Policy -> FROM DVDs -> ORDER BY Name;+-----------+--------+------------------------------+| Name | Rating | Policy |+-----------+--------+------------------------------+| Africa | PG | OK to rent to minors. || Amadeus | PG | O
1. Check whether the webshell Trojan is placed in the root directory of the site. check whether it is a PHP Trojan script based on the statement.# Find/storage/www/-name "*. php" | xargs grep-in -- color "eval ("# Grep-I -- include = '*. php'-r system \ s * \ (/storage/www/2. Analyze the number of times that access logs appear from the same ip address, such as leeching, attacks, and robots# Cat access. log | awk '{print $1}' | sort | uniq-c | sort-rn3. analyze the specific data access situation
To learn more about getline in awk getline, you must first understand the concepts of $0, NR, and FNR. The so-called NR can be understood as NumberofRecord, or a row number, while FNR can be understood as NumberofRecordinFile, or become a row number in the file. it sounds no different... getline of awk
To learn more about getline, you must first understand the concepts of $0,
. width, src. height );Dst. data. set (src. data );Return dst;},/*** Convolution-keneral size 5*5-blur effect filter (Fuzzy effect)** @ Param context* @ Param canvasData*/BlurProcess: function (context, canvasData ){Console. log ("Canvas Filter-blur process ");Var tempCanvasData = this. copyImageData (context, canvasData );Var sumred = 0.0, sumgreen = 0.0, sumblue = 0.0;For (var x = 0; x For (var y = 0; y // Index of the pixel in the arrayVar idx = (x + y * tempCanvasData. width) * 4;For (var su
In shell commands or programming, awk's powerful text processing capabilities can be used. If you want to format a message or
If data packets are extracted from large text files, awk can complete these tasks. Awk is an explanation.
Programming Language . Awk is also the most difficult to master in Shell filtering tools. Awk is a self-explanatory compilation.
Language. Combining awk, sed, and grep makes awk programming easier. The most basic feature of the awk language is to browse and extract i
Awk is broad and profound, and I have not been deeply studied in the work except for simple usage.Another, attach several blog articles, follow up may update this list:
Linux awk Command Detailed http://blog.chinaunix.net/uid-25120309-id-3801250.html
Http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html
"AWK" Removes the space:awk ' {result=gensub (//, "", 1);p rintresult} ' print a section of content:awk ' {print $7} ' access.log statistics IP number:awk ' {cs[$1]+=
, $3. In particular, awk uses $0 to represent the entire row (record ). Different fields are separated by characters called delimiters. The default Delimiter is space. Awk allows the use of-F in command lineTo change the separator. In fact, awk uses a built-in variable FS to remember this separator. Awk has several such built-in variables, for example, record the delimiter variable RS, the number of records currently working NR, etc. The appendix belo
"; Public void show () {system. out. println (this. head + "" + this. body + "" + this. foot) ;}} class shouren extends Ren {Public String head = "orcs head"; Public String body = "orcs body-heterogeneous"; // It does not matter if it is different, I didn't see any puppies because the red fruit was caught by the relevant departments. Public String foot = "Orc foot"; Public void show () {system. out. println (this. head + "" + this. body + "" + this. foot) ;}} class Nanren extends Ren {Public Str
, and a part of a row is used as a field in the record. In order to operate these different fields, awk uses the shell method to represent different fields in the row (record) in sequence in the form of 1, 2, 3. In particular, awk uses 0 to represent the entire row (record ). Different fields are separated by characters called delimiters. The default Delimiter is space. Awk allows you to change the Separator in the form of-f re in the command line. In fact, awk uses a built-in variable FS to rem
.
(5.1.5) Atomic variable auto-increment/auto-Increment
Void atomic_inc (atomic_t * V );
Void atomic_dec (atomic_t * V );
(5.1.6) operate and Test
// If the atomic value is 0 after the operation ends, true is returned. Otherwise, false is returned.
Int atomic_inc_and_test (atomic_t * V );
Int atomic_dec_and_test (atomic_t * V );
Int atomic_sub_and_tes (int I, atomic_t * V)
(5.1.7) operation and return
// After the operation is completed, a new value is returned.
Int atomic_add_return (int I, ato
" data and the sampling of "suspicious" data will pass.
Important algorithm analysis:
Static int variance_read (struct tslib_module_info * info, struct ts_sample * SAMP, int nr){Struct tslib_variance * Var = (struct tslib_variance *) Info;Struct ts_sample cur;Int COUNT = 0, DIST;
While (count If the sample data is marked as "submitted noise", assign the structure related to the current sample data to the noise status and clear the flag.If (Var-> flags
part of a row is used as a field in the record. To operate on these different fields, awk uses the shell method to represent different fields in the row (record) in sequence in the form of $1, $2, $3. In particular, awk uses $0 to represent the entire row (record ). Different fields are separated by characters called delimiters. The default Delimiter is space. Awk allows you to change the Separator in the form of-f re in the command line. In fact, awk uses a built-in variable FS to remember thi
System Connection Status Chapter:1. View TCP connection StatusNetstat-nat |awk ' {print $6} ' |sort|uniq-c|sort-rnUniq used to report or ignore duplicate rows in a fileUniq-c: Displays the number of occurrences of the row next to each column;By counting the characters that recur in a fileThen in descending order by Sort-rnNetstat-n | awk '/^tcp/{++s[$NF]}; END {for (a in S) print A, s[a]} ' orNetstat-n | awk '/^tcp/{++state[$NF]}; END {for (key in) print key, "\ T", State[key]} 'ListNetstat-n |
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.