|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
transponse row to coloumn output
dears
i have row data as below: ======================================================================================== Session Count: 24580 Session Count: 13426 Session Count: 22533 Session Count: 0 Session Count: 0 Session Count: 15036 Session Count: 11625 Session Count: 6942 Session Count: 11958 Session Count: 25082 Session Count: 22489 ====================================================== Session Count: 24354 Session Count: 13457 Session Count: 22425 Session Count: 0 Session Count: 0 Session Count: 14913 Session Count: 11553 Session Count: 6810 Session Count: 11714 Session Count: 24920 Session Count: 22212 ======================================================= and i want to make the output like this: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: 24580 13426 22533 0 0 15036 11625 6942 11958 25082 22489 ============== ========================================================================== Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: Session Count: 24354 13457 22425 0 0 14913 11553 6810 11714 24920 22212 ============== ========================================================================== so any one can help me in getting a script can do this? thank you |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Try: Code:
awk -F': ' '/^=/{print p ORS q ORS $0;p=q=x;next}{p=p $1 FS;q=q $2 OFS}' infile-or- Code:
awk -F ': ' 'NR==1{next}/^=/{print p ORS q ORS $0;p=q=x;next}{p=p $1 FS;q=q $2 OFS}' infileLast edited by Scrutinizer; 02-21-2012 at 04:15 AM.. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
greaaaaat wrok thank you
![]() |
|
#4
|
||||
|
||||
|
I have posted a matrix transpose script here few days ago: http://www.unix.com/shell-programmin...into-rows.html Code:
#!/bin/bash
transpose()
{
awk '
{
if (max_nf<NF)
max_nf=NF
max_nr=NR
for (x=1; x<=NF; ++x)
vector[x, NR]=$x
}
END {
for (x=1; x<=max_nf; ++x) {
for (y=1; y<=max_nr; ++y)
printf("%s ", vector[x, y])
printf("\n")
}
}' ${1}
}
transpose ${1} |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing coloumn value to system function in awk | max_hammer | UNIX for Dummies Questions & Answers | 2 | 07-07-2011 08:10 AM |
| How to copy one coloumn from one file to another | navjotsingh | UNIX for Dummies Questions & Answers | 2 | 02-12-2009 12:39 PM |
| How To display second coloumn values | naughty21 | Shell Programming and Scripting | 6 | 07-22-2008 09:42 AM |
| how to make a line BLINKING in output and also how to increase font size in output | mail2sant | Shell Programming and Scripting | 3 | 04-14-2008 07:30 AM |
| How to change Raw data to Coloumn data fields | Nayanajith | Shell Programming and Scripting | 1 | 08-29-2006 01:23 AM |
|
|