常用AWK命令

时间:2025-04-14 22:05:01

常用AWK命令##


Awk is a programming language which allows easy manipulation of structured data and the generation of formatted reports. Awk stands for the names of its authors Aho, Weinberger, and Kernighan.

###一、什么是AWK

USAGE:

    Unix:  awk '/pattern/ {print "$1"}'    # standard Unix shells
DOS/Win: awk '/pattern/ {print "$1"}' # okay for DJGPP compiled
awk "/pattern/ {print \"$1\"}" # required for Mingw32

二、AWK 查找/Search 与 替换/Substitute

参考:

1、Awk One-Liners Explained, Part II: Text Conversion and Substitution

2、awk cheat sheet

三、AWK编程

REFER:使用AWK去掉重复的单词

參考:


1、The GNU Awk User’s Guide

2、8 Powerful Awk Built-in Variables

3、Awk Introduction Tutorial – 7 Awk Print Examples