On Thu, Dec 29, 2005 at 11:15:04AM -0500, Tom Callahan wrote: > I'm trying to parse a certain section from an html file, but cannot figure out how to. > > The section I am looking at is below: > > <----------START FILE----------------------> > cfg: tab_config_1 > tab_bernstein_tape_zone; tab_bernstein_zone; > tab_bud_tape_zone; tab_bud_zone; tab_capone_tape_zone; > tab_capone_zone; tab_dev9ias_tape_zone; tab_dev9ias_zone; > tab_devdb_tape_zone; tab_devdb_zone; tab_devecom_tape_zone; > tab_devecom_zone; tab_devhttp_tape_zone; tab_devhttp_zone; > tab_ecom_tape_zone; tab_ecom_zone; tab_oesdev_tape_zone; > tab_oesdev_zone; tab_oraprod1_tape_zone; tab_oraprod1_zone; > tab_sanapp_zone; tab_tahoe_tape_zone; tab_tahoe_zone; > tab_wmsa_tape_zone; tab_wmsa_zone; tab_wmsdev_tape_zone; > tab_wmsdev_zone; tab_citius_tape_zone; tab_citius_zone; > red1_tape_z1; red1_tape_z2; red1_z1; red1_z2; red2_tape_z2; > red2_z2; blue1_tape_z1; blue1_tape_z2; blue1_z1; blue1_z2; > blue2_tape_z1; blue2_tape_z2; blue2_z1; blue2_z2; > yellow1_tape_z1; yellow1_tape_z2; yellow1_z1; yellow1_z2; > yellow2_tape_z1; yellow2_tape_z2; yellow2_z1; yellow2_z2; > tab_dl140a_tape_z1; tab_dl140a_z1; tab_dl380a_1_tape_z1; > tab_dl380a_1_z1 > cfg: tab_test_1 > tab_devhttp_zone; tab_devhttp_tape_zone; tab_devecom_zone; > tab_devecom_tape_zone; tab_devdb_zone; tab_devdb_tape_zone; > tab_dev9ias_zone; tab_dev9ias_tape_zone; tab_citius_zone; > tab_citius_tape_zone; tab_capone_zone; tab_capone_tape_zone; > tab_bud_zone; tab_bud_tape_zone; tab_bernstein_zone; > tab_bernstein_tape_zone; tab_dl380a_1_tape_z1; > tab_dl380a_1_z1; tab_ecom_tape_zone; tab_ecom_zone; > tab_oesdev_tape_zone; tab_oesdev_zone; tab_oraprod1_tape_zone; > tab_oraprod1_zone; tab_sanapp_zone; tab_tahoe_tape_zone; > tab_tahoe_zone; tab_wmsa_tape_zone; tab_wmsa_zone; > tab_wmsdev_zone; tab_wmsdev_tape_zone; red1_tape_z1; > red1_tape_z2; red1_z1; red1_z2; red2_tape_z2; red2_z2; > blue1_tape_z1; blue1_tape_z2; blue1_z1; blue1_z2; > blue2_tape_z1; blue2_tape_z2; blue2_z1; blue2_z2; > yellow1_tape_z1; yellow1_tape_z2; yellow1_z1; yellow1_z2; > yellow2_tape_z1; yellow2_tape_z2; yellow2_z1; yellow2_z2 > <---------------END FILE---------------------> > > What I want is to be able to only grab the section from "cfg: tab_config_1 " to just before the next "cfg:" and ignore everything else in the file. How about: [ewilts@pe400 ~]$ cat foo.awk /cfg/ { variable = $2 print ("variable="variable) } $1!~/cfg/ { print ("appending to " variable) vararray[variable] = (vararray[variable] $0) } END { print "wrapping up and dumping array" for (i in vararray) { print "\n",i,":" print vararray[i] } } What this does is assign each variable to an array element and concatenate the list below it. So you'll have one vararray[tab_config_1] and one for vararray[tab_test_1]. This should give you the general approach. Cheers, .../Ed p.s. you made me work for that one! -- Ed Wilts, RHCE Mounds View, MN, USA mailto:ewilts@xxxxxxxxxx Member #1, Red Hat Community Ambassador Program -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list