Print Only Text Following a Match
I have the following text in a file called n8n-deployment: ... image: busybox:1.36 image: docker.io/n8nio/n8n:2.13.4 imagePullPolicy: IfNotPresent ... And I want to use Regex search and match the version of n8n, in this case 2.13.4 should be output. Here’s how this can be done using Ripgrep (rg) command. ➜ rg -N -o -P 'image.*n8n:\K.*$' n8n-deployment.yaml 2.13.4 Another way to do this is: ➜ rg -oN 'image.*n8n:(.*)' -r '$1' n8n-deployment.yaml 2.13.4 Or, with grep: ➜ grep -o -P 'image.*n8n:\K.*$' n8n-deployment.yaml 2.13.4 Explanation of flags: ...