您现在的位置是:网站首页> 编程资料编程资料

awk区间取值的例子_linux shell_

2023-05-26 476人已围观

简介 awk区间取值的例子_linux shell_

有如下的文本内容:
*********
123123
123123
*********
321321
321321
*********
456456
456456
*********
123123
123123
********

匹配123,取出******区间的内容:
awk -vRS="*+" '/123/{print RT$0}' file

说明:
RS The input record separator, by default a newline(\n).
RT The record terminator. Gawk sets RT to the input text that matched the character or regular expression specified by RS.

-六神源码网