
Alvaro
Novice
Feb 25, 2010, 2:20 PM
Post #1 of 5
(10714 views)
|
Help. Get words between commas... please help!!!
|
Can't Post
|
|
Hi, I need to grab specific parts of a configuration file and copy them to another .txt file. A sample of the configuration: === interface gigabitEthernet 3/0/0.1445 vlan id 1445 ip description IRA 1934962; RJIRCS_EHI-101; HUAWEI; IRA-RJ-MAN-SWTL3-J01; ge-3/0/5.1445 pppoe === What I need is the word between the first and second ";". This word always changes, so I need to check the line that starts with "ip description" (there's always a space before it) and grab it to a file. There could be several commands like that on one file, so I need to append. As I'm a telecommunication guy, Perl is really not my expertise, so I just got the scipt below, to verify I was reading line by line. That's what I got so far. #!C:\Perl\bin\perl.exe use English; open (FILE, "<BRAS.txt"); while (<FILE>) { my($line) = $_; chomp($line); print "$line\n"; } close (FILE); Can anyone help, PLEASE!!!! Thanks so much
|