Tag: awk examples

AWK tutorial: awk regex example

What Is Regex? Types of Regex:BRE and ERE. Awk using BRE regex Patterns, Special Characters; Awk using ERE regex Patterns, matches the start...

awk loop example: awk for and while

awk for loop: awk -F"#" '{for(i=1;i<=NF;i++) { ... }' t.txt; awk for loop array: awk 'BEGIN{a["km"] = "m";a["kn"] = "n";for(i in a) {...}}'; awk while loop: awk -F"#"...

AWK tutorial: three ways of awk execution

Linux awk command execution ways: 1. Command line execution Detailed introduction of syntax, see 《Linux awk》 2. Shell script file execution Explanation: !/usr/bin/awk The first...

awk NR FNR difference

Linux awk command can use variables NR and FNR to process multiple files. NR : ordinal number of the current record, multiple files self-increase FNR...

AWK tutorial: awk sort uniq

In daily development, we often use awk command to cut and sort log file columns and count them. awk sort uniq count example awk column...

awk system batch operation

1. use awk command batch creation of files awk 'BEGIN {do {++i; system("touch file_num_" i "_test") } while (i<9) }' .........