Regular expression – AWK line symbol regular expression

I have a simple awk script called “script.awk”, which contains:

//some_simple_string / {print $0;}

I use it to parse some files containing the following content:
(by using: cat file | awk -f script.awk)

< /p>

14 catcat one_two/some_thing
15 catcat one_three/one_more_some_simple_string
16 dogdog one_two/some_simple_string_again
17 dogdog one_four/some_simple_string
18 qweqwe firefire/ppp

I want the script to print only strokes that fully reflect “/some_simple_string [END_OF_LINE]” instead of 2 or 3.
Is there an easy way?

I think the most appropriate way is to add a sigh at the end of the line in the regular expression.
So it only parses the strokes that start with “/some ..”, and add them in “..string [ END_OF_LINE]” add a new line at the end

Expected output:

17 dogdog one_four/some_simple_string

Sorry for the confusion, I Regular expressions for END OF LINE sign-in are required.
The correct answer is:

//some_simple_string$/ {print $0;}

< div class="content-split">

You can use anytime:

//some_simple_string$/ { print $0 }

Not only matches “some_simple_string” but also matches “/some_simple_string” followed by the end of the line ($ is the end of the line in the regular expression)

I have a simple awk script called “script.awk”, which contains:

//some_simple_string/ {print $0;}

I use it to parse some files containing the following content:
(By using: cat file| awk -f script.awk)

14 catcat one_two/ some_thing
15 catcat one_three/one_more_some_simple_string
16 dogdog one_two/some_simple_string_again
17 dogdog one_four/some_simple_string
18 qweqwe firefire/ppp

I want the script to only print completely Reflect “/some_simple_string[END_OF_LINE]” instead of 2 or 3 strokes.
Is there a simple way?

I think the most appropriate way is to add a sigh at the end of the line in the regular expression.
So it only parses the strokes that start with “/some ..”, and add them in “..string [ END_OF_LINE]” add a new line at the end

Expected output:

17 dogdog one_four/some_simple_string

Sorry for the confusion, I Requires END OF LINE sign-in regular expression.
The correct answer is:

//some_simple_string$/ {print $0;}

< p>

You can use it at any time:

//some_simple_string$/ {print $0 }

Not only Match “some_simple_string” and match “/some_simple_string” followed by the end of the line ($ is the end of the line in the regular expression)

Leave a Comment

Your email address will not be published.