Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I tried awk before (the default implementation on most distros) to do a simple task of making a template engine, I learnt a bit about awk and sed (basic stuff) but I couldn't manage to do what I wanted that I could do in python with a few lines and one minute.

The man pages are nice but I didn't have the patience to start reading every thing to just do simple stuff like replace regex pattern with a content of a file located at the path generated from a capture group of that regex and some other stuff.



> to do a simple task of making a template engine

Not quite sure what you mean but it does sound like awk was the wrong tool for the job there. For the sort of templating I'm thinking of shell scripts or m4 would have been a better tool. Taking some structured data and piping it to one of those is where awk shines (that and pattern matching).


It was for making a static site generator. Templating engine was a part of it where I wanted to add functionality for components, generating event handling, adding SEO (meta tags), gluing shell code etc similiar to jsx/vue.


Would you have been able to do that in python if you hadn't previously programmed in python, read the docs, seen examples?


Yeah, because it's easier to find what you need. I think I came across only big guides or irrelevant examples/answers - pretty old too.

Comparatively, perl was also easier to find stuff for in their docs. I ended up using that for some places.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: