spakin/awk

getline available?

suntong opened this issue · 8 comments

Hi,

Is the awk's function getline somehow available?

I'm researching the tools that I can use for this,
https://groups.google.com/d/msg/golang-nuts/tf4aDQ1Hn_c/pemlt7brBAAJ
and am thinking that your awk package might be the only viable option for me now, to parse my xml by awk.

However, I do badly need the awk's getline function, because "when I'm at a certain token, and want to print out the entire raw xml as-is, the standard encoding/xml lib doesn't even allow me to" (from above url).

So I badly need to supply my own loop on meeting certain xml tokens, reading/modifying/dumping lines until the end xml tag is met.

Can you provide an example on how to do self getline loop please?
Thanks

I think the funtionality of getline is there already, we just need to expose it as Getline for the time being, I meant, the funtionality of getline also includes reading from another file, which is nice to have, as I'm using it in my other awk script now.

Thanks again.

Hm?
Project abandoned?

On 12/01/2015 09:55 AM, suntong wrote:

Hm?
Project abandoned?

Working on getline…be patient.

— Scott

Oh, that's great news. Sorry to have been impatient because I didn't know.
Thanks for the effort!

I believe I have getline working as of the latest commit (81db0f4). The new Script.GetLine method is intended to follow the semantics of AWK's getline fairly closely.

— Scott

Excellent!!! I'll try it out right away. Thanks a lot!

FTA, forgot to mention that I've tested it with my example on 2 Dec 2015.

Glad to hear that everything's working. Thanks for letting me know.

— Scott