Transpose one line/lines from column to row using shell

Solution 1:

If that's a single column, which you want to convert to row, then there are many possibilities:

tr -d '\n' < filename ; echo # option 1 OR
xargs echo -n < filename ; echo # option 2 (This option however, will shrink spaces & eat  quotes) OR
while read x; do echo -n "$x" ; done < filename; echo # option 3

Please let us know, how the input would look like, for multi-line case.

Solution 2:

A funny pure bash solution (bash ≥ 4.1):

mapfile -t < file.txt; printf '%s' "${MAPFILE[@]}" $'\n'

Done!