Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RegEx in awk and WinGrep

So I'm looking for a pattern like this:

size='0x0'

In a log file, but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW)

size='0x[0-9a-fA-F]{4,}

But the same RegEx does not work in awk - seems like the repetition {4,} is messing it up. Same with WinGrep - any idea from the RegEx gurus? Thanks!

like image 506
Jeff Avatar asked Jan 24 '23 00:01

Jeff


1 Answers

You can in fact use awk, with a caveat.

As mentioned on the following page, you need a special command-line option (--re-interval) to make it work out, since the interval expression (the {4,}) is not in the standard:

http://kansai.anesth.or.jp/gijutu/awk/gawk/gawk_28.html

So in the end, you'll want something that looks like:

awk --re-interval "/size='0x[0-9a-fA-F]{4,}'/" thefile

This will print out the lines that match.

like image 138
Dan Fego Avatar answered Jan 30 '23 05:01

Dan Fego