Jun 11, 2004 #1 valle70 IS-IT--Management Jun 11, 2004 6 DK Hi "who -m" gives me following output root user1 "who -m|awk '{printf("%s",$1)}'" gives me following oupput rootuser1 I would like make a awk script that orders the lines show below seperated by a _ root_user1 who do I do this ? Regards
Hi "who -m" gives me following output root user1 "who -m|awk '{printf("%s",$1)}'" gives me following oupput rootuser1 I would like make a awk script that orders the lines show below seperated by a _ root_user1 who do I do this ? Regards
Jun 11, 2004 2 #2 PHV MIS Nov 8, 2002 53,708 FR Try something like this: who -m|awk '{printf "%s",(NR>1?"_":"")$1}' Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Try something like this: who -m|awk '{printf "%s",(NR>1?"_":"")$1}' Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Jun 11, 2004 #3 guggach Programmer Jun 10, 2004 159 CH there are sure better ways to do this, but the answer to your question is: who -m|awk '{printf("%s%s",(xx++) ? "_" : "",$1);}' dont forget the closing ';' after ')' for syntax purists be sure you are using the new-awk guggach Upvote 0 Downvote
there are sure better ways to do this, but the answer to your question is: who -m|awk '{printf("%s%s",(xx++) ? "_" : "",$1);}' dont forget the closing ';' after ')' for syntax purists be sure you are using the new-awk guggach
Jun 11, 2004 #4 guggach Programmer Jun 10, 2004 159 CH bonjour PHV, en effet 'NR' est bien plus efficace que 'xx' je corrige: who -m|awk '{printf("%s%s",(NR >1) ? "_" : "",$1);}' guggach Upvote 0 Downvote
bonjour PHV, en effet 'NR' est bien plus efficace que 'xx' je corrige: who -m|awk '{printf("%s%s",(NR >1) ? "_" : "",$1);}' guggach