Re: SED Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 16, 2004, at 10:27 AM, Mike Vanecek wrote:

On Sun, 16 May 2004 10:12:21 -0400, Jason Dixon wrote
I'm not a sed expert, but I'm guessing it's behaving "greedy",
similar to perl regex.  The first SRC actually falls within the ".*"
portion of your match, and the last match is what counts.

I thought it would pick up the first? If I change the second SRC to SRX, then
it does pick up the first one.

Right. As I explained, the .* is greedy.


What do I need to specify to make it pick up the first one?

No clue, I only use sed for very basic one-liner substitutions. I'd suggest using perl and split()-ting up your stdin to an array. Let me know if you need assistance with this. You can always look in my Hatchet code (http://www.dixongroup.net/hatchet) for ideas. It's for OpenBSD PF logs, but the concepts are the same.


--
Jason Dixon, RHCE
DixonGroup Consulting
http://www.dixongroup.net



--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux