I have two files containing as below
cat file1.txt
a b c
1 2 3
cat file2.txt
a
b
c
1
2
3
I want file1 to be arranged as
a
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.