On Fri, Jan 15, 2010 at 1:57 PM, David Wolfskill <[email protected]> wrote:
> On Fri, Jan 15, 2010 at 01:51:34PM -0800, Garrett Cooper wrote:
>> ...
>> >
>> > d254(6.4-S)[7] echo //////// | awk '{ gsub (/\/{2,}/, ""); print }'
>> > ////////
>> > d254(6.4-S)[8] echo //////// | awk '{ gsub (/\/+/, "/"); print }'
>> > /
>> > d254(6.4-S)[9]
>>
>>     I'm avoiding this because it would create an infinite loop in my
>> awk script (I want to squish slashes, not eliminate them completely
>> :)...).
>
> Errr...  I thought "/\/{2,}/" was a regex referring to "2 or more
> consecutive /", and the replacement was "", which sounds about as close
> to eliminating them completely as I can imagine.  :-}
>
> How about:
>
> d254(6.4-S)[10] echo //////// | awk '{ gsub (/\/\/+/, "/"); print }'
> /
> d254(6.4-S)[11]
>
> then?

    This works very well. Is the expression quantifier operator [ `{'
] not supported in awk like perl, python, tcl, etc?
Thanks,
-Garrett
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

Reply via email to