Well, for any potential future readers, I had no luck getting grep
to do it, I’m sure it was my fault somehow and not grep’s, but thanks to the help in this post I was able to use awk
instead of grep
, like so:
docker exec -it 1c8c05daba19 awk '/^\$OC_VersionString/ && match($0,/\047[0-9]+\.[0-9]+\.[0-9]+\047/){print substr($0,RSTART+1,RLENGTH-2)}' /config/www/nextcloud/version.php
That ended up doing exactly what I needed:
- It logs into a docker container.
- Scans and returns just the version number from the line I am looking for at:
/config/www/nextcloud/version.php
inside the container. - Exits stage left from the container with just the info I needed.
- I can get right back to eating my Hot Cheetos.
CLICK HERE to find out more related problems solutions.