I need to get the browser version which is followed by browser name and / in my log file. Example
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0.5.7
Here i would like to extract the version which comes after Firefox i.e (17.0.5.7). I have tried the following, but no success. As i am using AIX, i am unable to make use of -O flag.
grep -w 'Firefox\/[^ ,]\+' $line
sed 's/^.*\(Firefox\/[^ ,]*\).*$/\1/' $line
Also i need use the command inside while do loop like below
while read -r line
do
case $line in
*Firefox*) print "<browser Firefox>\"" command_to_be_executed $line "\"</browser>";;
*) print "<browser>\"Unknown\"</browser>";;
esac
done < filename
Thanks in adavance.
Since it’s the last field in the line, you can do:
It prints the lines which checks whether the it is “Firefox” and prints the version followed.
Simply do echo on
lineand get the version.