I have a string that looks like this:
GenFiltEff=7.092200e-01
Using bash, I would like to just get the number after the =
character. Is there a way to do this?
Using Pure Bash. Two Bash parameter expansion techniques can help us to remove the last character from a variable: Substring expansion – ${VAR:offset:length} Removing matching suffix pattern – ${VAR%word}
${var/ /} removes the first space character. ${var// /} removes all space characters.
Use parameter expansion, if the value is already stored in a variable.
$ str="GenFiltEff=7.092200e-01" $ value=${str#*=}
Or use read
$ IFS="=" read name value <<< "GenFiltEff=7.092200e-01"
Either way,
$ echo $value 7.092200e-01
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With