nawk worked. Just one bug that I've discovered in testing. The following input
modifyTimestamp: 20040719990632Z
modifiersName: uid=superadmin,dc=.
HsiaStaticAddrInfo: s999-232-127-159@xxx.net@0:0:0:0:0:0@999.23
2.127.159
HsiaStaticAddrInfo: s999-232-127-160@xxx.net@0:0:0:0:0:0@999.23...
Not quite.
First the 1 cause an error. If I remove it it runs.
Second it only outputs the lines that contian HsiaStaticAddrInfo
I need the other sample lines outputed as well unmodified.
Close, it doesn't handle the following condition.
HsiaServiceOption: Server-2-IP@0@0@2@2@yes
HsiaServicePoint: Region 650
HsiaStaticAddrInfo: s1-1-1-1@xx.net@0:B0:D0:E7:2E:14@2
16.232.87.259
HsiaStaticAddrInfo: s1-1-1-1@xx.net@0:B0:D0:E7:2E:14@2
16.232.87.260
HsiaStaticAddrInfo...
Is there a way to do only the merge if it starts with StaticAddrInfo: ? For lines that do not start with StaticAddrInfo: just print it as is.
I've tried the following but it's not working?
awk '{buf=buf""$0;if($0~/StaticAddrInfo:/){if($0!~/:/){print buf;buf=""}}}'
Hi
I'm looking for an awk script that can merge the following two records into 1 record. Can anyone help?
StaticAddrInfo: s1-1-1-1@xx.net@0:0:0:0:0:0@1.1.
1.1
The key is that the second record does not contain a ':'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.