![]() |
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 |
| More than transposing! | bulash | UNIX Desktop for Dummies Questions & Answers | 3 | 04-11-2008 05:20 PM |
| Transposing string | unibboy | Shell Programming and Scripting | 3 | 02-13-2008 06:12 PM |
| Another transposing issue | stevesmith | Shell Programming and Scripting | 14 | 09-16-2006 04:48 AM |
| file transposing | mskcc | Shell Programming and Scripting | 24 | 08-04-2005 11:23 AM |
| transposing letters | myscsa2004 | Shell Programming and Scripting | 4 | 05-12-2004 10:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Some thing similar
+++++++ cat filename | paste -s - +++++++ Or for more advance operations, I have awk script by some forum like this +++++++ #! /bin/sh ## ------------------------------------------------------------ ## -- Transpose a matrix: ## -- Assumes all lines have same number of fields ## -- ## -- Usage: ## -- script <STDIN> ^D ## -- script <input file> ## -- cat <input file> | script ## ------------------------------------------------------------ exec awk ' BEGIN { FS = "," OFS = "," } NR == 1 { n = NF for (i = 1; i <= NF; i++) row[i] = $i next } { if (NF > n) n = NF for (i = 1; i <= NF; i++) row[i] = row[i] "," $i } END { for (i = 1; i <= n; i++) print row[i] }' ${1+"$@"} +++++++ This assumes "," as input file field seperator |