![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to transpose a table of data using awk | ahjiefreak | Shell Programming and Scripting | 2 | 07-28-2008 11:43 PM |
| How to transpose data elements in awk | ahjiefreak | Shell Programming and Scripting | 2 | 05-13-2008 04:44 AM |
| How do I transpose a column of results to a row | m223464 | Shell Programming and Scripting | 6 | 05-06-2008 07:33 AM |
| Row to column transpose | videsh77 | Shell Programming and Scripting | 10 | 06-16-2007 12:54 PM |
| transpose command | su_in99 | UNIX for Dummies Questions & Answers | 3 | 05-16-2007 05:10 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Transpose Rows
Hi,
Am trying to transpose a set of rows into a set of comma separated values. For eg. if the output of ps -ef | tail +2 | awk 'BEGIN{ FS=" " } { print $2 }' is 0 1 3 4 I need to transpose it to - '0','1','3','4' Am currently trying - ps -ef | tail +2 | awk 'BEGIN{ FS=" " } { print $2 }' | tr '\n' ',' > tmpFile sessList=`cat tmpFile | sed s/.$/\'/ | sed s/^/\'/ | sed s/\,/\'\,\'/ ` echo $sessList However that does not seem to work. Any pointers towards achieving this more efficiently/elegantly will be of great help. |
| Bookmarks |
| Tags |
| comma separated, transpose |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|