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
The idiomatic awk approach of simply setting the OFS or ORS to the FS or RS as appropriate before printing (and recompiling the record if necessary with $1=$1) will work with any awk:
$ cat file1
a b c
1 2 3
$ awk '{OFS=RS;$1=$1}1' file1
a
b
c
1
2
3
$ cat file2
a
b
c
1
2
3
$ awk '{ORS=(NR%3?FS:RS)}1' file2
a b c
1 2 3