I'm doing a grep on postcodes eg
grep "B2 4" filename
However this gives me results such as AB2 4 and CB2 4. I've looked at the man page and can't see how to match only the string and no extras.
Thanks
Yep the ",B2 4" seems to work fine. I've created a pattern file that looks like this:
",B24 "
",B31 "
",B32 "
",B47 "
",B54 "
",B79 9"
",B95 6"
",BA4 4"
",BA8 0"
",BA9 8"
and am trying to do a grep -f patternfile postcodefile but I get no results. However if I do them individually it finds them. Any ideas what the problem could be?
In your example lines, none of the patterns matches an enrty in the postcodes. To test it, I changed ,B24 to ,AB24 and it works fine on SCO Openserver 5.0.5. Are you aware of the space characters after the patterns? Do they exist also in the postcodes? What does cygwin manual says about -f ?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.