From: "Ned" <ngranic@cox.net>
To: "Speakup is a screen review system for Linux." <speakup@braille.uwo.ca>
Subject: Re: bash regular expressions
Date: Mon, 4 Apr 2005 16:22:59 -0700 [thread overview]
Message-ID: <001801c5396d$3dd1b820$4e31e444@nedelko83f1172> (raw)
In-Reply-To: <20050404230311.GA4731@taylor.homelinux.net>
Thanks bro,
it definitely works.
Now, as you pointed out, why the \ is not enough, we'll leave that for some
later time.
Ned
----- Original Message -----
From: "Lorenzo Taylor" <lorenzo@taylor.homelinux.net>
To: "Speakup is a screen review system for Linux." <speakup@braille.uwo.ca>
Sent: Monday, April 04, 2005 4:03 PM
Subject: Re: bash regular expressions
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ned's comments on bash regular expressions were as follows:
> # I wrote a bash script and all but the two commands below were marked
> wrong, so I need to correct them. Hope you don't mind pointing out my
> mistakes:
>
> Well, I'll see what I can do. Here goes nothing! <smile>
>
> # 1. needs to output how many lines are there with a . (period) in them. I
> used the escape char \ before the period, but it apparently didn't work.
> #
> # echo Output the number of lines that have a \"\.\" \(period\):
> # grep -c \. ./test.file
>
> Try:
>
> echo Output the number of lines that have a \".\" \(period\):
> grep -c [.] ./test.file
>
> I can't explain it, but somehow it only works that way. Escaping the
> period
> doesn't help. It must be specified in a range by itself.
>
> # 2. this one needs to output the number of lines containing the string
> '/*':
> #
> # echo Output the number of lines that have the string \"'/'\*\":
> # grep -c /\* ./test.file
>
> Try this instead:
>
> echo Output the number of lines that have the string '"/*"':
> grep -c [/][*] ./test.file
>
> Again, each character seems as though it must be enclosed in range
> brackets by
> itself. Not exactly sure why without further digging in manpages for
> grep(1) and
> regex(3), which is something I may do in the future if the mood hits me,
> but as
> long as this works, I just don't feel like it right now. <smile>
>
> HTH,
> Lorenzo
> - --
> "We decided that we should evaluate the Microsoft offerings first. Once we
> realised what a powerful set of tools they were, it became self-evident
> this was
> the right way to go down."
>
> Microsoft: the right way to go down
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.0 (GNU/Linux)
>
> iD8DBQFCUcevG9IpekrhBfIRAs1uAJ9/qfMLcyIuzP19Tx8I5HlIbEC/VACeJHod
> RaMPPXLUHrKsBmDFYk2f2p4=
> =R6qv
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
next prev parent reply other threads:[~ UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
Ned
` Lorenzo Taylor
` Ned [this message]
` Sean McMahon
` Ralph W. Reid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001801c5396d$3dd1b820$4e31e444@nedelko83f1172' \
--to=ngranic@cox.net \
--cc=speakup@braille.uwo.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).