I've got a file that I need to get a piece of text from using regex. We'll call the file x.txt. What I would like to do is open x.txt, extract the regex match from the file and set that into a parameter. Can anyone give me some pointers on this?
EDIT
So in x.txt I have the following line
$variable = '1.2.3';
I need to extract the 1.2.3 from the file into my bash script to then use for a zip file
var=$(grep regex file)or you're going to have to be a lot more specific.group [0-9]\+? Sure. Or if you just want the number,grep -oP '(?<=group )[0-9]+'var=$(sed -ne 's/^[^=]*= *'\([^']*\)'.*/\1/p' file)