Sed command tutorial in linux/unix with examples and use cases
sed is a stream editor. 1. sed workflow
2. hold space and pattern space explain
3. sed syntax
4. sed debug tool
5. sed example
...
How to using multiple delimiters in awk and sed
Multiple delimiter-separated fields in awk or sed.
Using awk command:
➜ awk -F'[:=|]' '{print $1, $2, $3}' test.log;
Using sed command:
➜ sed 's/[:=|]/ /g' test.log...
echo command tutorial in linux/unix with examples and use cases
linux echo command - one of the most commonly used commands and is commonly used in scripting languages to display a line of text/string on...
rename file linux – use rename cmd or mv cmd or awk cmd
Rename file in linux has two ways: linux rename command and linux mv command. linux rename command rename command – renames multiple files. Ubuntu is...
AWK tutorial: awk group by count
When we are dealing with log files, we often need to count the number of times some keywords appear. For example, count the number of...
awk merge files base on the keyword
use the awk variables NR and FNR merge files base on the keywords.
awk -F' ' 'NR==FNR{a[$1]=$2;}NR!=FNR{print $0, a[$1]}' test-4.txt test-5.txt...
awk custom function and examples
Here, you need to use the awk custom function to implement the abs function. awk 'function abs(x){return (x < 0) ? -x : x;} {print...
AWK tutorial: find and kill process use awk
Step 1. View the process ID pid of the top command.
Step 2. Use the awk command to get the process ID.
Step 3. Use...
AWK tutorial: awk -F and awk BEGIN{ FS … }
Usually, when I use awk for text processing, I prefer to use the awk -F option for text field separation. Of course, we can also...
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...
use the linux command to find the max value and print
Mostly used for log processing, there are several ways: first way: awk -v, second way: awk+sort+head, Third way: sed+sort+head, fourth way: sort -t+head ......
Linux shell batch move files, delete spaces, rename files
1. Use linux find, move files in batch;
2. Use linux find, delete empty directories in batch;
3. Use shell while loop, batch delete spaces in file...
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"#"...
linux vim command arguments and vim workflow
Vim Very powerful text editor. As a R&D engineer, you must be proficient in the vim command. Vim is divided into three modes: Command Mode,...
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...