![]() |
|
|
|
|
|||||||
| 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 |
| How to convert a single column into several rows and columns? | ashton_smith | UNIX for Dummies Questions & Answers | 5 | 05-24-2008 01:44 PM |
| Script to add a single line to middle of text file. | progkcp | Shell Programming and Scripting | 2 | 05-12-2008 11:44 AM |
| difference between double inverted coma and single inverted comma | abhisekh_ban | Shell Programming and Scripting | 1 | 02-15-2007 08:03 AM |
| Second comma to new line. | deepakwins | UNIX for Dummies Questions & Answers | 3 | 02-13-2007 11:35 PM |
| Add a comma at end of every line | ST2000 | Shell Programming and Scripting | 4 | 07-14-2002 03:49 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |
| Forum Sponsor | ||
|
|