AWK で行ではなくパラグラフを入力単位にする¶
サンプルファイル: cfg.sample
item
group = someSection
att1 = aaa
att2 = bbb
item2
group = someSection2
att1 = AAAD
att2 = bbb
パラグラフ単位で検索する。
# パラグラフの何処かにある部分文字列で検索
$ awk -F"\n" -v RS="" '/AAAD/' cfg.sample
item2
group = someSection2
att1 = AAAD
att2 = bbb
# 行頭の文字で検索
$ awk -F"\n" -v RS="" '/^item\n/' cfg.sample
item
group = someSection
att1 = aaa
att2 = bbb
Last modified: 2016-12-19 | ||
|
||
|
|
||
| © Shin Nakamura/BasicWerk 2008 - 2025 |