Given the following input
line1
line2
line3
would it be possible to append them all into a single array element and then output them the as
line1
line2
line3
with a single print statement? Semi-pseudo-code: awk '{[append $0 to a[test]}; END {print a[test]}' file1
A more complicated but more practical example problem is given two files, file 1 is:
line1
line2
line3
and file2 is:
linea
lineb
linec
how would I produce output like so:
linea
line1
line2
line3
lineb
line1
line2
line3
linec
line1
line2
line3
My assumption that this would require an array is what is underlining my original question.
A couple of tests such as a[test]+=$0 and a[test]=a[test]+$0 have predictably failed.