<div dir="ltr">Part of this reminds me of when Bash evaluates an expression (e.g. <b style="font-weight:normal" id="docs-internal-guid--2355a13-c9bd-6dda-c047-00c685ff94e8"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">ap*les → aptles</span></b>) when a file named aptles exists in the working directory, but the intended search pattern is apples, appples, etc.<br>
<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 6, 2013 at 2:56 PM, Jake Vath <span dir="ltr"><<a href="mailto:jake.vath@gmail.com" target="_blank">jake.vath@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm apologize, I didn't read your email in its entirety.<span class="HOEnZb"><font color="#888888"><br>
</font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div>-> Jake<br></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 6, 2013 at 2:23 PM, <span dir="ltr"><<a href="mailto:canito@dalan.us" target="_blank">canito@dalan.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br>
Quoting Jake Vath <<a href="mailto:jake.vath@gmail.com" target="_blank">jake.vath@gmail.com</a>>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Did you copy-past that if-statement wrong?<br>
You're missing a closing ]<br>
<br>
-> Jake<br>
<br>
<br>
On Fri, Dec 6, 2013 at 2:09 PM, <<a href="mailto:canito@dalan.us" target="_blank">canito@dalan.us</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the process of writing a script which I would like to count the number<br>
matched patterns (command line parameters).<br>
<br>
The issue I am running into using grep is that the string has a dash in<br>
front, and it throws an error.<br>
<br>
E.g:<br>
<br>
./script -test<br>
<br>
PATTERN=$1<br>
<br>
egrep -ic $PATTERN --> egrep: invalid option -- 't'<br>
<br>
awk and egrep work using a file, but not on a variable:<br>
<br>
EXAMPLE=`awk '/test/ { nlines++ } {print nlines}' $PATTERN`<br>
<br>
awk: cmd. line:1: fatal: cannot open file `-test' for reading (No such<br>
file or directory)<br>
<br>
I know using and if command works, so am I just over doing it? What am I<br>
doing wrong?<br>
<br>
if [[ $PATTERN == "-test" ]; then<br>
<br>
Thanks in advanced!<br>
<br>
Saul David Alanis<br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org" target="_blank">tclug-list@mn-linux.org</a><br>
<a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/<u></u>mailman/listinfo/tclug-list</a><br>
<br>
</blockquote></blockquote>
<br></div></div>
Hi Jake-<br>
<br>
Thanks, just a typo. :)<br>
<br>
I would like to know if I am just missing something using egrep / awk?<br>
<br>
SDA<div><div><br>
<br>
______________________________<u></u>_________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org" target="_blank">tclug-list@mn-linux.org</a><br>
<a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/<u></u>mailman/listinfo/tclug-list</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota<br>
<a href="mailto:tclug-list@mn-linux.org">tclug-list@mn-linux.org</a><br>
<a href="http://mailman.mn-linux.org/mailman/listinfo/tclug-list" target="_blank">http://mailman.mn-linux.org/mailman/listinfo/tclug-list</a><br>
<br></blockquote></div><br></div>