Row to column and column to row using awk
Some awk
version
awk 1 RS=" |\n" file1 # gnu awk version
awk '{for (i=1;i<=NF;i++) print $i}' file1 # portable version
a
b
c
1
2
3
awk '{printf "%s" (NR%3==0?RS:FS),$1}' file2
a b c
1 2 3
printf "%s"
# print pararameter #1 ($1)NR%3==0?"RS:FS
# add extra formatting. Test if line is number 3. If its not, use FS (a blank space), if it is use RS, a new line.
So this adjust the next parameter after every 3 line.
I'd use xargs
for this:
$ xargs -n1 < file1
a
b
c
1
2
3
$ xargs -n3 < file2
a b c
1 2 3