[oclug] My first dum question of the day
Ahmed Masud
masud at googgun.com
Thu Apr 5 12:04:26 EDT 2001
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Well if you are looking for the _WORD_ BOB
Mr. BOB was a good man
BOBBING was his hobby
IF the only line you were interested in was the first and wanted to
ignore the second one then:
grep -e '^BOB$' -e '^BOB[ \t]' -e '[ \t][ \t]*BOB[ \t]' -e '[
\t]BOB$'
Also, you may want to replace [ \t] with a more language specific
(english in this case)
thing:
e.g. the above would not match
Once upon a time, there lived a guy named BOB. He was a happy guy.
but:
grep -e '^BOB$' -e '^BOB[ \.,!;\?\t]' -e '[ \t][ \t]*BOB[
\.,!;\?\t]' -e '[ \t]BOB$'
would match BOB in above, and in most punctuated sentences. But you
get the idea.
Ahmed.
> -----Original Message-----
> From: oclug-admin at lists.oclug.on.ca
> [mailto:oclug-admin at lists.oclug.on.ca]On Behalf Of Computer Books
> For Less
> Sent: Thursday, April 05, 2001 10:09 AM
> To: oclug at lists.oclug.on.ca
> Subject: [oclug] My first dum question of the day
>
>
> Hi,
>
> How would I do a search like this...
>
> Search a line and find the word BOB, but only if it is in caps?
>
> The search must be done using posix based regular expressions.
>
> Thanks
>
> Sincerely,
> Bruce Harding
> Manager: Computer Books For Less
> Manager of Procurements: Computer Supply House
>
> 105 O'Connor Street
> Ottawa ON K1P 5M8
> Canada
> Phone: 613-233-7418
> Fax: 613-233-6823
>
> 122 Princess Street
> Kingston ON K7L 1A7
> Canada
> Phone: 613-531-4550
> Fax: 613-544-8007
>
> http://www.computerbooksforless.com
>
> _______________________________________________
> oclug mailing list
> oclug at lists.oclug.on.ca
> http://www.oclug.on.ca/mailman/listinfo/oclug
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOsyXhuA+WVFT6/r4EQLUmwCg1/XkNjL2qKZdCd8GTNAeWNAt8ykAoO8u
iQLTJOPOEV+jLJQj7p2cAb2X
=vvO6
-----END PGP SIGNATURE-----
More information about the OCLUG
mailing list