I really don’t know if awk would be the appropriate tool for that task… Maybe something in python would be better. Anyway, I thought asking here first for the feasibility of the task. Here we go :
Datas :
###
offspr84 175177 200172 312312 310326 338342 252240 226210 113129 223264
male28 197175 172200 308312 310338 262338 256252 190226 113129 223219
female13 197177 172172 312308 318326 342350 240248 210218 129113 267247
###
offspr85 181177 192160 320312 290362 358330 238238 214178 133129 263223
male65 197181 176192 320268 322286 358330 238244 206214 137133 267263
female17 181177 160172 280312 362346 350326 230238 126178 129129 223167
###
So basicaly I need to print the first field ($1) and matching (in bold) $9 in the first record and matching $2 and $6 in second record.
Output file :
offspr84 113129
male28 113129
offspr85 181177
female17 181177
offspr85 358330
male65 358330
Any hint on how I could accomplish that ?
Thanx !
This code will produce the output you want. Maybe not the best way, but seems to work as expected.
Update:
With a nested list to include both list at once: