converting column to row

Hi everyone..

I have a list of values in a file...

1.2345e-1
2.282828e+
3.2341e-1
1.1223445e-1

I am interested in converting this column to a row..

1.2345e-1 2.282828e+ 3.2341e-1 1.1223445e-1

can anyone pls help?? I am a liunx newbie..

Thanks..

Hi kjha,

$ awk 'BEGIN { ORS = " " } { print }' infile

Regards,
Birei

There is always this:

awk  '{ printf( "%s ", $1 ); } END { printf( "\n" ); }' input-file >output-file
tr '\n' ' ' < infile

or

sed -e 'N;N;N;s/\n/ /g' infile
paste -sd" " inputfile
xargs < infile

I would suggest caution with this idiom.

In this specific case, where a single row/line of output is desired, if the actual data is large enough, it's possible that echo could be invoked more than once.

In the generic case, a line in the data that looks like a command option could silently yield incorrect results.

Regards,
Alister

Thanks Alister, much appreciated!