Part of this reminds me of when Bash evaluates an expression (e.g. *ap*les
→ aptles*) when a file named aptles exists in the working directory, but
the intended search pattern is apples, appples, etc.



On Fri, Dec 6, 2013 at 2:56 PM, Jake Vath <jake.vath at gmail.com> wrote:

> I'm apologize, I didn't read your email in its entirety.
>
> -> Jake
>
>
> On Fri, Dec 6, 2013 at 2:23 PM, <canito at dalan.us> wrote:
>
>>
>> Quoting Jake Vath <jake.vath at gmail.com>:
>>
>>  Did you copy-past that if-statement wrong?
>>> You're missing a closing ]
>>>
>>> -> Jake
>>>
>>>
>>> On Fri, Dec 6, 2013 at 2:09 PM, <canito at dalan.us> wrote:
>>>
>>>  In the process of writing a script which I would like to count the
>>>> number
>>>> matched patterns (command line parameters).
>>>>
>>>> The issue I am running into using grep is that the string has a dash in
>>>> front, and it throws an error.
>>>>
>>>> E.g:
>>>>
>>>> ./script -test
>>>>
>>>> PATTERN=$1
>>>>
>>>> egrep -ic $PATTERN --> egrep: invalid option -- 't'
>>>>
>>>> awk and egrep work using a file, but not on a variable:
>>>>
>>>> EXAMPLE=`awk '/test/ { nlines++ } {print nlines}' $PATTERN`
>>>>
>>>> awk: cmd. line:1: fatal: cannot open file `-test' for reading (No such
>>>> file or directory)
>>>>
>>>> I know using and if command works, so am I just over doing it? What am I
>>>> doing wrong?
>>>>
>>>> if [[ $PATTERN == "-test" ]; then
>>>>
>>>> Thanks in advanced!
>>>>
>>>> Saul David Alanis
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
>>>> tclug-list at mn-linux.org
>>>> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>>>>
>>>>
>> Hi Jake-
>>
>> Thanks, just a typo. :)
>>
>> I would like to know if I am just missing something using egrep / awk?
>>
>> SDA
>>
>>
>> _______________________________________________
>> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
>> tclug-list at mn-linux.org
>> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>>
>
>
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> tclug-list at mn-linux.org
> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20131206/0292fabe/attachment.html>