Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

output awk print horizontally

Status
Not open for further replies.

grazinggoat

Programmer
Mar 12, 2008
41
0
0
US
Hello

I did a search of the forum but couldn't find my answer.

I'm tracking parent and child processes that I want my child pids to be listed horizontally
instead of vertically. I attempted to insert a tab but this is not working.

MYPID="$$"
echo "PPID: ${MYPID}"

CHILDPIDS=$(ps -ef -o user,pid,ppid |grep ${MYPID}| awk '{print "\t"$2}'
echo "Child PIDS: $CHILDPIDS"

so that my output comes out like so:

PPID: 0001
Child PIDS: 1001 1002 1003

Thanks for any insight
 
Replace this:
print "\t"$2
with this:
printf "\t%s",$2

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Notice the use of printf instead of print ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top