Hi MillerH/ishnid,
Thanks for all the suggestions you provided. I was able to create the script I needed and at the same time I applied the same concepts to other scripts I'm doing.
Knowledge of both Perl and REGEX is very useful :-)
Regards
viadisky
Thanks for all the information :-)
I'm currently learning REGEX using and most of the examples in the book I'm using have egrep. I'm using the code I posted earlier to simulate examples in the book. Thank you again.
Regards
viadisky
Hi,
I'm currently running this version of Perl in my MS Windows XP machine.
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 33 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 819 [267479] provided by ActiveState...
Hi ishnid,
Thank you very much for your suggestion. It worked!!!
I added something that would make the script dump the output to a text file instead.
Is there an easy way of dumping what is inside an array to a text file? I used "foreach" loop in this case.
#!C:\Perl\bin\perl.exe
open (FILE...
Hi,
I created a very basic Perl script that can grep item inside a file and display the result on the screen.
#!C:\Perl\bin\perl.exe
open (FILE, '<Fruits.txt')or die "$!\n";
@array = <FILE>;
@result = grep (/apple/, @array);
print @result;
close (FILE);
Fruits.txt contains these lines...
Hi Spookie,
Thanks for the suggestion you provided :-)
But this REGEX matched the file with these lines:
ip name-server 172.21.204.33
ip name-server 172.21.204.34
ip name-server 1.1.1.12
That's why I had to type the exact IP Addresses to have 100% match.
Regards
vaidisky
Hi,
I need the help of all regex gurus out there.
Listed below are standard lines I need to check inside a file. A file should be okay if all these lines can be found and in the right order.
ip name-server 4.3.2.1
ip name-server 3.2.3.2
ip name-server 1.1.1.1
I created a very basic REGEX to...
Ooppsss, i had typo error in my previous email (sorry)
ip name-server 4.3.2.1
ip name-server 3.2.3.2
ip name-server 1.1.1.1
I created a very basic REGEX to do this:
^ip name-server 4\.3\.2\.1$
^ip name-server 3\.2\.3\.2$
^ip name-server 1\.1\.1\.1$
Hi,
I need the help of all regex gurus out there.
Listed below are standard lines I need to check inside a file. A file should be okay if all these lines can be found and in the right order.
ip name-server 4.3.2.1
ip name-server 3.2.3.2
ip name server 1.1.1.1
I created a very basic REGEX to...
Ooopss ... I forgot there is a small note that Feherke added in his posting ...
"The second solutions will not work well if there are input lines without that markup. Specify more about the input format if needed."
I will try a different approach ....
Hi,
I submitted this query before and Feherke kindly provided solution: (thread822-1198142)
I'm trying to use the same sed command to format my data but I think I missed something because it's not providing the result I'm expecting.
My original data looks like this:
MRTG$ grep -i "System"...
Both PHV's and Feherke's suggestions are both correct !!! Thanks ...!!!
The only thing I need to do before using the script is that no data is missing because if one "In" data is missing .. the computation will be wrong. The data I need to work on is shown below and as you can see I have...
I search in google for a free tutorial on this side of awk (putting data in an array) but most tutorial I've seen are showing basic examples ...
I tried to change some portion of the script given by PHV (I find it easier to modify his script because he included the computation already) and I...
Both Feherke's and PHV's codes worked if I use "nawk"...
PHV's script has the actual computation results but it only shows in "In" data ...
ifInOctets_26Jan2007_12:25:00_10_s1/6-ifInOctets_26Jan2007_12:20:00_10_s1/6-->384509644-384506513=3131...
Both Feherke's and PHV's codes worked if I use "nawk"...
PHV's script has the actual computation results but it only shows in "In" data ...
ifInOctets_26Jan2007_12:25:00_10_s1/6-ifInOctets_26Jan2007_12:20:00_10_s1/6-->384509644-384506513=3131...
Hi Feherke,
Thank you so much for the additional information you provided. I also saw this basic example of NR%2 :
awk 'NR % 2 == 0' file
Looking at the first code you provided (this is still producing errors when I run it). I will try to undertsand it bit-by-bit so i can easily modify it...
Hi,
I saw this in awk's manpage ...
getline var --> reads the next record into var, updates NR and FNR.
is there a way I can use this getline?
Thanks ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.