I have a text file with a line among others:
Submitting job with ID: 50fd2805-6fcc-4bc6-91a2-638528180ab6
(It's a full line, and it has other lines before and after.)
I need to find and extract to a variable the ID. I came up with a RexEx pattern:
[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}
The patterns should work, but it doesn't seem to work in Shell with anything I tried: grep, sed – whatever.
One of my attempts was this:
JOB_ID=$(grep '[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}' file)
To be clear, as a result I need JOB_ID
to contain string "50fd2805-6fcc-4bc6-91a2-638528180ab6" (without quotes.)
I'm sorry for such a seemingly noob question, but I couldn't find anything on the internet: I've read dozens of similar questions on SO and SE, and googled several tutorials, and still couldn't figure out the answer.
Any guidance is appreciated!