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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -