![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| More than transposing! | bulash | UNIX Desktop for Dummies Questions & Answers | 3 | 04-11-2008 02:20 PM |
| Transposing string | unibboy | Shell Programming and Scripting | 3 | 02-13-2008 03:12 PM |
| Major Awk problems (Searching, If statements, transposing etc.) | Blivo | Shell Programming and Scripting | 2 | 09-05-2007 03:41 AM |
| Another transposing issue | stevesmith | Shell Programming and Scripting | 14 | 09-16-2006 01:48 AM |
| transposing letters | myscsa2004 | Shell Programming and Scripting | 4 | 05-12-2004 07:11 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#22
|
|||
|
|||
|
it didn't work. there are uneven values in eash row, some row have 500 records, some have 200, i dont' know if that's problem.
the error is, bash-2.03$ ./file_transpose nawk: record `atcc_rma_pvsall_bot5...' has too many fields input record number 3, file atcc_fidler_genename_markers source line number 2 the code is, ###file transpose, colume to row ###from unix.com/Ygor, 07/29/2005 nawk -v OFS='\t' '{ for (f = 1; f <= NF; f++) a[NR, f] = $f } NF > nf { nf = NF } END { for (f = 1; f <= nf; f++) for (r = 1; r <= NR; r++) printf a[r, f] (r==NR ? RS : OFS) }' infile > outfile |
| Forum Sponsor | ||
|
|
|
#23
|
||||
|
||||
|
that is the problem - too many fields for the 'nawk' to handle.
if you have 'gawk' installed on your system - try that instead of 'nawk'. or if on Solaris, try '/usr/xpg4/bin/awk'. The other problem is that the solution assumes the consistent number of columns for ALL the rows. Good luck. P.S. for the future - pls don't repost already posted unmodified solutions - it clutters the thread. |
|
#24
|
|||
|
|||
|
it worked! thank you so much. but only one problem left, some of the record being changed. for example,
input record c2 is mad1///mad2///mad3 (one record), output is mad1, ///, mad2, ///, mad3 (file records); can this be fixed? thanks again. I got your point for post a request. Thanks. |
|
#25
|
||||
|
||||
|
I don't quite understand what you're saying, but you'll have to look at your input data and see the 'wrong' records "differ" from the rest - most likely this "difference" breaks the implementation.
Good luck. Last edited by vgersh99; 08-05-2005 at 07:32 AM. |
||||
| Google The UNIX and Linux Forums |