将- sss A=
- Key 1
- sss Av=
- Hello 1
- World 1
- Av.fff
-
- sss B=
- Key 2
- sss Bv=
- Hello 2
-
- World 2
- Bv.fff
-
- sss C=
- Key 3
- sss Cv=
- Hello 3
- World 3
- Cv.fff
-
- sss kv=
- @
- {A}={Av}
- {B}={Bv}
- {C}={Cv}
- DDD(kv)
复制代码 以ANSI格式保存为1.txt
将- /sss [^ ]=/ {
- A = substr($0, 1, 5) "v="
- B = substr($0, 5, 1) "v.fff"
- while ((getline) > 0) {
- if ($0 == B) {
- print "---"
- next
- }
- if ($0 == A) {
- print "-"
- } else {
- print
- }
- }
- }
复制代码 以ANSI格式保存为1.awk
下载gawk( http://bcn.bathome.net/tool/4.1.0/gawk.exe )
执行- gawk -f.\1.awk 1.txt>2.txt
复制代码 结果(2.txt)- Key 1
- -
- Hello 1
- World 1
- ---
- Key 2
- -
- Hello 2
-
- World 2
- ---
- Key 3
- -
- Hello 3
- World 3
- ---
复制代码
|