I have a file with some patterns and a corresponding value for each pattern(Regex) in the following way:
path group
/hello/get/** @group1
/hey/get/you @group2
/hi/get/ping_*.js @group3
/hello/get/** @group4
I want to get the corresponding group value for the path I have given. For example if I give "/hello/get/book.js" I should get @group1.
How can I do that?
I have tried searching for the Regex, but I am not sure how to fetch the corresponding group from the file. Also, the grep returns the matching line if there is an exact match but not the Regex match. For example, when I give
grep '/hey/get/you' FILENAME
I get the following output: /hey/get/you @group2
But, if I give the following:
grep '/hello/get/hello.js'
it doesn't return anything.
The expected result for the string '/hello/get/hello.js' should be @group1, @group4