bash - Printing file content on one line -
i'm lost trying thought straightforward : read file line line , output on 1 line.
i'm using bash on rhel. consider simple test case file (test.in) following content:
one 2 3 4
i want have script reads files , outputs:
one 2 3 4 done
i tried (test.sh):
cat test.in | while read in; printf "%s " "$in" done echo "done"
the result looks like:
# ./test.sh foure done #
it seems printf causes cursor jump first position on same line after %s. issues holds when doing echo -e "$in \c"
.
any ideas?
you can use:
echo -- $(<test.in); echo 'done' 1 2 3 4 done
Comments
Post a Comment