bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] funcsub func needed


From: Kjetil D. Midtlie
Subject: [bug-gawk] funcsub func needed
Date: Sat, 6 Dec 2014 20:20:48 +0100 (CET)

gensub needs an expression language in replace, and that language is awk:

So a new function funcsub(regex,funcNameStr,how[,target]) extending gensub() is 
born
using "\\1" etc is such a pain when i need to modify the value 


funcNameStr is "pointing" to a func w signature :
fn( arr ) that returns string.
arr contains all grp-matches expanded like how match() does

(today you can only use a shift-type loop w the match() func to get the same 
feature AND IT IS SLOOOW)

This will be a killer feature for scenarios where u need to reduce/alter 
grp-values before them ending up in output

gensub is cool but I always end up doing a complex 2nd-pass-replace on 
extracted grp-vales that can not be used directly in output....
(Involving wrapping grp-values in bizarre placeholders that is unlikely to 
appear in text otherwise)

____________________________ 

Kjetil Flovild-Midtlie 
Developer/Softwarearcitect

Docstream as 
Hvamstubben 17, N-2013 Skjetten 
Mobile (+47) 92 09 56 15 
Office (+47) 48 11 12 00 
Fax (+47) 63 84 08 12 
www.docstream.no 
____________________________ 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]