![]() |
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 convert a single column into several rows and columns? | ashton_smith | UNIX for Dummies Questions & Answers | 5 | 05-24-2008 05:44 PM |
| Script to add a single line to middle of text file. | progkcp | Shell Programming and Scripting | 2 | 05-12-2008 03:44 PM |
| difference between double inverted coma and single inverted comma | abhisekh_ban | Shell Programming and Scripting | 1 | 02-15-2007 11:03 AM |
| Second comma to new line. | deepakwins | UNIX for Dummies Questions & Answers | 3 | 02-14-2007 02:35 AM |
| Add a comma at end of every line | ST2000 | Shell Programming and Scripting | 4 | 07-14-2002 07:49 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi All,
I'm using the following script to produce a result: #!/bin/sh awk ' $0 ~ /\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+Interface\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+\+/ { match_str="YES"; line_cnt=0; next; } { if((line_cnt < 5) && ( match_str=="YES")) { print $0; line_cnt += 1; } else { match_str="NO"; line_cnt=0; } }' InputFileName I'm getting the following result: IFName: aust00m1.mis.amat.com[ 0 [ 257 ] ] ObjID: 5eceea48-0d59-71dd-1512-9887a1f10000 IFAlias: Dest: AMNA austkchr1-ser0/0/0:0.315 Type: FRASI CID: DHEC.559128 IFDescription: ATM9/1/0.315-atm subif Status: Normal IFName: aust00m1.mis.amat.com[ 0 [ 258 ] ] ObjID: 5ed18d98-0d59-71dd-1512-9887a1f10000 IFAlias: Dest: AMNA austkchr1-ser0/0/0:0.315 Type: FRASI CID: DHEC.559128 IFDescription: ATM9/1/0.315-aal5 layer Status: Normal IFName: aust00m1.mis.amat.com[ 0 [ 259 ] ] ObjID: 5ed53358-0d59-71dd-1512-9887a1f10000 IFAlias: Dest: AMNA austkchr1-ser0/0/1:0.325 Type: FRASI CID: DHEC.531638 IFDescription: ATM9/1/0.325-atm subif Status: Normal I want to convert Each 5 Rows to 5 Columns separated with , (comma). IFName: aust00m1.mis.amat.com[ 0 [ 257 ] ],ObjID: 5eceea48-0d59-71dd-1512-9887a1f10000,IFAlias: Dest: AMNA austkchr1-ser0/0/0:0.315 Type: FRASI CID: DHEC.559128,IFDescription: ATM9/1/0.315-atm subif,Status: Normal IFName: aust00m1.mis.amat.com[ 0 [ 258 ] ],ObjID: 5ed18d98-0d59-71dd-1512-9887a1f10000,IFAlias: Dest: AMNA austkchr1-ser0/0/0:0.315 Type: FRASI CID: DHEC.559128,IFDescription: ATM9/1/0.315-aal5 layer,Status: Normal I have modify the above script according to my requirement. Pls. anybody help me out. Thanks, Gobinathan.S |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|