Skip to main content
added 80 characters in body
Source Link
shagon
  • 303
  • 4
  • 14

I wrote a regular exprssion:

(?<value>(?<=start=)\d+)

I'tested it in Exprsso and it works When Itried to use it in BASH script, there are no rsultresult, althogh the data is the same as in the test with Expresso. Can a gruoping be used with grep, and return array like result?

grep -Po "(?<value>(?<=start=)\d+)" page.txt > result.txt

Is this the way it is used?

Edit - example data (working)

www.example.com/check?var=test&start=11

I wrote a regular exprssion:

(?<value>(?<=start=)\d+)

I'tested it in Exprsso and it works When Itried to use it in BASH script, there are no rsult, althogh the data is the same as in the test with Expresso.

grep -Po "(?<value>(?<=start=)\d+)" page.txt > result.txt

Is this the way it is used?

I wrote a regular exprssion:

(?<value>(?<=start=)\d+)

I'tested it in Exprsso and it works When Itried to use it in BASH script, there are no result, althogh the data is the same as in the test with Expresso. Can a gruoping be used with grep, and return array like result?

grep -Po "(?<value>(?<=start=)\d+)" page.txt > result.txt

Is this the way it is used?

Edit - example data (working)

www.example.com/check?var=test&start=11
Source Link
shagon
  • 303
  • 4
  • 14

Grep with grouping regex

I wrote a regular exprssion:

(?<value>(?<=start=)\d+)

I'tested it in Exprsso and it works When Itried to use it in BASH script, there are no rsult, althogh the data is the same as in the test with Expresso.

grep -Po "(?<value>(?<=start=)\d+)" page.txt > result.txt

Is this the way it is used?