[ACCEPTED]-Output on a single line-awk

Accepted answer
Score: 12

whenever you want to combine all lines of 1 output into one you can also use xargs:




find |xargs echo
. ./zxcv ./fdsa ./treww ./asdf ./ewr
Score: 6

you can use tr to get your output to one 1 line

<output from somewhere> | tr "\n" " "
Score: 1

The newline is generated by the echo command 4 most likely, the following should do the 3 same without the newlines (not tested)

mysqlshow -uroot -pPassWord | awk '{print $2}' | egrep -v 'Databases|information_schema'

and 2 has the added bonus of spawning just 1 grep 1 instead of 3 grep processes.

Score: 1

To do a variation combining naumcho's and rsp's answers 1 that will work for small numbers of results:

echo $(mysqlshow -uroot -pPassWord | awk '{print $2}' | egrep -v 'Databases|information_schema')

More Related questions