I have file like this:
1
2
3
4
How to get result like that by awk or similar:
1 2 3 4
I have file like this:
1
2
3
4
How to get result like that by awk or similar:
1 2 3 4
echo $(cat file)
if the file is short.
awk '{printf("%s ",$0)}' <file
if you want awk or similar.
paste -sd\ infile
Note that the above command contains two white space characters (an escaped and a plain one).
awk '{printf $0" "}' your_file