Example I have ver.txt
#tac
version=xxx
I want to display only xxx.
I can try grep, sed, gawk.Just want to learn how to make it.
Example I have ver.txt
#tac
version=xxx
I want to display only xxx.
I can try grep, sed, gawk.Just want to learn how to make it.
One of many ways is to use grep
interpreting the pattern as a perl
regular expression, and use a positive look-behind:
grep -oP '(?<=version=).*' infile
the awk answer:
awk -F = '$1=="version" {print $2}' file
Sed
sed -n '/^version=/s///p' file
If you are running these commands from a windows command prompt, then single quote is not a valid grouping character, you may have to do this
awk -F = "$1==\"version\" {print $2}" file