我需要将以下文件更改为新文件...
文件我和我在一起....
uid=GESCHELP1, ou=Special Users, dc=domain,dc=com
different: c
1: IND
different: sn
1: REC
uid=GESCHELP2, ou=Special Users, dc=domain,dc=com
different: country
1: USA
different: givenname
1: Raj
输出文件应如下.......
dn: uid=GESCHELP1, ou=Special Users, dc=domain,dc=com
changetype: modify
replace: c
c: IND
-
replace: sn
sn: REC
uid=GESCHELP2, ou=Special Users, dc=domain,dc=com
changetype: modify
replace: country
country: USA
-
replace: givenname
givenname: Aus
请帮我解决问题。
答案 0 :(得分:0)
此命令将提供所需的结果
awk -F':*' -v OFS =":" ' $ 1 =="替换" {R = $ 2;印刷;下一个}环R {$ 1 = R; R =""} 7'文件