hi,
i want to extract the sessionID from this line.
QnA Session Id :[11:128589]
here the output should be--
QnA_SessionID=128589
Thanks
NT
hi,
i want to extract the sessionID from this line.
QnA Session Id :[11:128589]
here the output should be--
QnA_SessionID=128589
Thanks
NT
I don't know perl. But this might be useful.
echo "QnA Session Id :[11:128589]" |awk -F"[:[ ]" '{ print $1"_"$2toupper($3)"="substr($7,1,length($7)-1) }'
no need regular expression, do it the simple way
my $string = "QnA Session Id :[11:128589]";
@a = split /:/, $string;
print $a[0];
print $a[2]; # remove the last "]" as needed...
while(<DATA>){
print $1,"_",$2,uc($3),"=",$4,"\n" if / ([^ ]*) \s* ([^ ]*) \s* ([^ ]*) .*: ([0-9]+)/x;
}
__DATA__
QnA Session Id :[11:123]
QnA Session id : [11:456]
QnA Session ID :[11:789]