Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ~$> cat awktest1.txt
- 111 112 113 114|121 122 123 124|131 132 133 134|141 142 143 144
- ~$> cat awktest2.txt
- 211 212 213 214
- 221 222 223 224
- 231 232 233 234
- 241 242 243 244
- #! /usr/bin/awk -f
- # awktest.awk file1 file2
- # cant swap RS between files
- BEGIN { RS="|" }
- NR>ONR && ONR==1 { RS="" }
- { print $1 "." $2 "." $3 "." $4 }
- # will work with with, but this is GNU only.
- # ENDFILE { RS="" }
- END { print "nfinal $0: n" $0 }
- ~$>./awktest.awk awktest1.txt awktest2.txt
- 111.112.113.114
- 121.122.123.124
- 131.132.133.134
- 141.142.143.144
- 211.212.213.214
- final $0:
- 211 212 213 214
- 221 222 223 224
- 231 232 233 234
- 241 242 243 244
Add Comment
Please, Sign In to add comment