[ACCEPTED]-Output on a single line-awk
Accepted answer
whenever you want to combine all lines of 1 output into one you can also use xargs:
e.g.
find
.
./zxcv
./fdsa
./treww
./asdf
./ewr
becomes:
find |xargs echo
. ./zxcv ./fdsa ./treww ./asdf ./ewr
you can use tr to get your output to one 1 line
<output from somewhere> | tr "\n" " "
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.
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')
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.