I have the following list in file
more file.ex
efifc1a
hygg4a
hdy5d
nhdw4s
wesf3a
fjfhyr
jfhg
gsfar
how to append any second list after the first list and any third list after the second list the following:
efifc1a nhdw4s jfhg
hygg4a wesf3a gsfar
hdy5d fjfhyr
awk
iteratesfor (i in a)
in indeterminate order; for the gawk's I have numbers up to 3 (your test case) happen to work but more don't; oh Ubuntumawk
up to 9 works, but on FreeBSDawk
even 2 fails, and I no longer have Solaris. Recent GNU awk can fix this withPROCINFO["sorted_in"]
but anywhere and easier you can usefor(i = 1; i in a; i++) print a[i]
. – dave_thompson_085 May 18 '16 at 00:29