#!usr/bin/perl
$file_name = "file.txt";
open(FILE,$file_name);
while(<FILE>)
{
my $line = $_;
if($line =~ m/Svr\b/)
{
my $server_name;
$server_name = $1;
print $server_name;
}
}
file.txt:
ewrerfSvr//To be extracted
Rate=rpm
ID=123
RATE=45
ADDR=retriveBal
Grocer="-r -e ${MAIN_ROOT}/logs/stderr -o ${MAIN_ROOT}/logs/stdout -A --"
freedonSvr
BALFSvr //to be extracted
Rate=rpm1
ID=12323
RATE=45etf
ADDR=retriveBal
Grocer="-r -e ${MAIN_ROOT}/logs/stderr -o ${MAIN_ROOT}/logs/stdout -A --"
freedonSvr -D ${REV_AccountBalance_NAME}"//
Also I want to extract:
REV_AccountBalance
Give me suggestion to do this using regular expression.