Need to grep 2 words from Perl Script results in Terminal....
Hey guys. I have a .pl script that scans my hosts to see if they are down or up. I can run it anytime I want. The script uses a conf file that contains text lines of the IP addresses of the servers. I run the script from the command line of my terminal (MAC OS)
I run:
brings back:
I want to only have displayed for me the results of the two xx.x.3.x results
but if I run this:
OR
then I get this:
10.0.2.3 - UP
10.0.3.5 - UP
10.0.3.6 - UP
But I only care about the last 2 results (3.5 and 3.6)
so I tried:
sudo ./scanner.pl | grep UP 3.
hoping that it would be able to grab the lines that have both of those parameters, but that doesnt work....
How do I specify 2 things to grab from one line?
For Example, I only want to display:
THANKS IN ADVANCE
Last edited by Yogesh Sawant; 04-18-2010 at 03:00 PM..
Reason: added code tags
I need help to further reduce the output shown below. I want to be able to only return the paragraph where the 'Database alias' is exactly equal to DBIHP. I do not want the other paragraphs being shown below.
$ echo $dbalias
DBIHP
$ db2 list db directory|grep -p 'Database alias ... (2 Replies)
hi
i am using perl on windows ( active state perl 5.8 ) and i want to check for Control-M (^M) in file. files to be checked are in unix format so new line character is (\n). This perl script is called from Batch file ( windows .BAT file )
my script is
while (<PROGRAM>) {
... (12 Replies)
I need to write a perl script to search for a specific set of numbers that occur after a series of words but before another. Specifically, I need to locate the phrase today at the summit, then immediately prior to the words tonnes/day copy the number that will be between 100 and 9,999, for example,... (1 Reply)
hello,
i 'd like your help about a bash script which:
1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel,
2.finds the link which leads to the download location of the Latest Stable Kernel version,
(the right link should lead to the file... (3 Replies)
Hello guys,
I have been looking around but can't find the answer to my problem:
If the grep command displays no results, print "no results have been found" and increment x. But if the grep command find something, do nothing.
if
echo "no results have been found $x"
x=`expr $x + 1 `... (3 Replies)
Hello,
Fairly simple really I have an xml file and I want to check to see if it contains a pattern. The pattern is "../"
On the command line I can type: grep "\.\./" myFile.xml
and I get desired result.
To do the same thing in a perl script I thought it was as simple as putting the ``... (4 Replies)
Hi,
I meet an problem that it cannot change Terminal environment variable in a perl or bash script.
This change can only exist and become effective in script lifetime.
But I want to make this change take effect in current opened Terminal.
In our view, the thought seems to be impossible,
As... (9 Replies)
Hi,
i have a file hello.log which as several line that look like the below
2015-12-07 09:46:56 0:339 120.111.12.12 POST /helloWorld
2015-12-07 09:46:57 0:439 122.111.12.12 POST /helloWorld
....
when i grep expecting to see results like the below.
... (6 Replies)