类比SQL select * from table where field like “%a”
less nginx.log | grep 404 -n
less nginx.log | grep 404 -nv
less nginx.log | grep '^n' -
less nginx.log | grep 'n$' -
sed 是流编辑器,一次处理一行内容
sed -e 脚本
sed -f 脚本文件
类比SQL update fieldA from table where field = “abc”

man sed || sed -h
把文件逐行读入,以默认空格为分隔符将每行切片,切开的部分再进行后续处理。

类比SQL select fieldA from table
[root@curry-qa-01 etc]# awk -F: '/root/{print $0}' /etc/passwd
root:x:0:0:root:/root:/bin/bash
operator:x:11:0:operator:/root:/sbin/nologin
awk -F: 'NR==2{print $0}' /etc/passwd
awk -F : 'BEGIN{print "BEGIN BEGIN"} {print $1,$2}' /etc/passwd
BEGIN BEGIN
root x
bin x
daemon x
adm x
lp x
sync x
shutdown x
halt x
mail x
operator x
games x
ftp x
nobody x
systemd-network x
dbus x
polkitd x
sshd x
postfix x
chrony x
nscd x
tcpdump x
echo "111 222|333 444|555 666" | awk 'BEGIN{RS="|"} {print $0}'
111 222
333 444
555 666