AWK: The Most Powerful Utility Tool In Shell World.

xiaoxiao2021-03-06  61

1) Format: awk 'pattern' filename awk '{action}' filename awk 'pattern {action}' filename (a) awk '/ salby / {print $ 1} filename (b) ls -l | awk' $ 1 ~ / ^ D / {Print $ 0} '(c) ls -l | awk' $ 1! ~ / ^ D / {Print $ 0} '(D) awk' / ^ (no | so) / 'datafile (e) awk -f: '$ 3 == 100 || $ 4> = 150' FileName

2) Send the shell's variable to nawk

For example:

Origin = ls -l

Originb = `ls / | nawk -v swap =" $ Origin "'{Print Swap}'

3) NAWK '$ 2> 5 && $ 2 <= 15' FileName

转载请注明原文地址:https://www.9cbs.com/read-113582.html

New Post(0)