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

I want a Perl one. I never saw the need to do AWK because I knew Perl fairly well.

In saying that the youngsters should learn some of these old school tools. Python is a nice language but the regexes are crap acompared to Perl. I always need to look up the documentation. Perls are built in, clean and concise.

(caturing, groups) = string =~ /regex/

I remember that having not touched Perl in a while. I miss it.



Have yet to learn Perl, but I've frequently not seen it preinstalled on systems, and additionally you sometimes need CPAN to be able to run scripts. awk might not be as powerful, but at least you know it's small, self-contained, and likely to be available in some form on most systems. That's part of its value I think... likely a consequence of not trying to do as much.


re: why awk is almost always available, it's part of POSIX: https://pubs.opengroup.org/onlinepubs/009695399/utilities/aw...


Someone else already asked for perl one-liners in this thread. I started with command line text processing repo [1] about three years back. That has a chapter on grep/sed/awk/perl/ruby one-liners along with many other tools. I may convert perl one-liners to a book as well later.

Python's default 're' module does indeed lack many features, but there's 'regex' third party module that would be easier to adapt for perl users.

[1] https://github.com/learnbyexample/Command-line-text-processi...


There is an available replacement for Python's standard re library, regex[1], which adds a long list of features and enhancements. It is too little known IMO, despite having existed and been continually maintained and enhanced for nearly a decade.

[1] https://pypi.org/project/regex/




There is a perl oneliners book from nostarch press


It takes way less time to learn awk than perl.


Yes, but I already know Perl. I assume more people know Perl than AWK, but maybe that's a bias from places I worked.




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

Search: