On Thu, February 21, 2008 4:14 pm, Barry Gershenfeld wrote:
>>...I want to be selective about which sigs are selected...
>>I thought about making a script that...greps certain lines
>>from the main sig file...
>>But my problem is that I need grep to cough up everything
>>between the two "%" delimiters, not just the matching line....
>
> Learn awk, maybe?
>
> As your ideas become fancier, the programming effort you need also
> increases.  This is the natural succession of things.  While it may be
> possible to do it all with a shell script, more advanced programs can make
> it easier, more repeatable, and more modifiable.  I see you've gotten sed
> into the act, and that's the kind of next step I'm talking about.
>
> When I climbed onto the Linux bandwagon, I figured I needed to progress
> through 3 levels.  I see there are really 4.
>
> shell script
> sed
> awk
> perl
>
> And the reality was:
>
> I didn't realize shell scripts even counted as a language.  But growing up
> with DOS Batch would make you think that.  Shell scripts are good, and
> sometimes, a script is enough.  Often, there's a script behind the final
> product anyway.
>
> sed was easy enough, but every time I went to use it, it would break down
> as
> soon as I needed to handle things that took more than one line.  sed can
> work across line endings, but it ain't pretty.
>
> awk is like a real programming language.  It has the guilty pleasures
> associated with string handling, and easy (or no?) data typing, and of
> course with regular expressions thrown in.  awk solves most of my problems
> that are like the one you propose.
>
> perl, I never got to. I did read a "get started" article once, to sort of
> look into it, but didn't have a pressing need for it.   At the perl level,
> you have python and php and as it happened I've also learned php.
>
> So...awk is where I would go with this.  And if you want to try it (have
> you
> done any "programming language"s?), I'll help, as I suspect the onlookers
> would, too.
>
> Barry

... and I would recommend you skip sed and awk and go straight to perl,
which does it all in a more intuituve way.

-- 
Lan Barnes

SCM Analyst              Linux Guy
Tcl/Tk Enthusiast        Biodiesel Brewer

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to