您现在的位置是:网站首页> 编程资料编程资料
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.
*********
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.
相关内容
- Linux 脚本编写基础知识_linux shell_
- 浅析linux下如何用脚本自动发送文本mail邮件_linux shell_
- linux脚本实现自动发送和收取邮件的设置方法_linux shell_
- linux shell脚本基础知识学习_linux shell_
- 学习shell脚本之前的基础知识[图文]_linux shell_
- Linux里awk中split函数的用法小结_linux shell_
- linux shell实现获取用户输入指定范围的单个字符的两种方法_linux shell_
- awk中让人郁闷的system()函数_linux shell_
- 用shell+sendmail实现服务器监控报警小脚本_linux shell_
- 批量修改ssh配置的expect脚本_linux shell_
