Hi.
How can I write this differently:
awk '$3 ~ /0001/{print}'
Is there a way to write 0001 differently. I am looking for the pattern 01, with 3 or more 0 and 3 or more 1 in a pattern.
Thanks.
Hi.
How can I write this differently:
awk '$3 ~ /0001/{print}'
Is there a way to write 0001 differently. I am looking for the pattern 01, with 3 or more 0 and 3 or more 1 in a pattern.
Thanks.
/0000*1111*/
awk '$3 ~ /0{3,}1{3,}/' file
/0000*1111*/ is nice but what if I want to match 0 twenty times?
I am not going to type 000000000....
awk '$3 ~ /0{3,}1{3,}/' file is not working 
Could you explain what doesn't work?
Which OS?
If Solaris, try nawk.
In sed, it's a bit different, \ and second count limited to 99; maybe in awk, too:
/0\{3,99\}1\{3,99\}/
I am using a Mac OS X.
Not working means that I am not getting anything back from the command even though I know that I should. It looks like nothing matches the awk pattern, but I am positive that the pattern I am looking for exists.
Please post the actual line that you want to match
For example:
0000000111111112222222
00111111111111111111
2222222444444401111111
The awk should only return the first line, not the last two lines.
I'm also using OS X.
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: Mac OS X 10.6.5 (10H574)
....
Interestingly, your sample data has only one ($1) field?
$ awk '$1 ~ /0{3,}1{3,}/' file
0000000111111112222222
Thanks!
awk '/000+/{print}' file
That'd be /000+111+/ if I recall the user requirement correctly, except he wants to specify the min length not in unary!