Issue
Given a string "pos:665181533 pts:11360 t:11.360000 crop=720:568:0:4 some more words"
Is it possible to extract string between "crop=" and the following space using bash and grep?
So if I match "crop=" how can I extract anything after it and before the following white space?
Basically, I need "720:568:0:4" to be printed.
Solution
I'd do it this way:
grep -o -E 'crop=[^ ]+' | sed 's/crop=//'
It uses sed
which is also a standard command. You can, of course, replace it with another sequence of greps, but only if it's really needed.
Answered By - Andrew Logvinov Answer Checked By - Cary Denson (WPSolving Admin)