in reply to extracting data from a line
Not totally sure what you're wanting from this... but if I'm reading correctly then this should work:
while (<DATA>) { /\/([^\/]+)\d$/; print $1."bot\n"; } __DATA__ ## /loc1/loc2/loc3/848xxxxxB01_d_1 ## /loc1/loc2/loc3/loc4/848xxxxxB01_d_1 ## /loc1/848xxxxxB01_d_1
Obviously here I'm replacing your input file with the __DATA__ block for ease of example and naturally you could change the print $1."bot\n"; to print MYOUTFILE $1."bot\n";.
All code is untested unless otherwise stated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: extracting data from a line
by RCP (Acolyte) on Oct 27, 2004 at 14:19 UTC | |
by gothic_mallard (Pilgrim) on Oct 28, 2004 at 07:10 UTC | |
by RCP (Acolyte) on Nov 02, 2004 at 16:59 UTC |