News for hackers. Stuff that matters.
Re:Show HN: An eBook with hundreds of GNU Awk one-liners by collyw on Thursday April 02, 2020 @03:53PM (#22763004)
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.

Re:Show HN: An eBook with hundreds of GNU Awk one-liners by mehrdadn on Thursday April 02, 2020 @08:05PM (#22765143)
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:Show HN: An eBook with hundreds of GNU Awk one-liners by anotheraccountf on Thursday April 02, 2020 @09:31PM (#22765606)
re: why awk is almost always available, it's part of POSIX: https://pubs.opengroup.org/onlinepubs/009695399/utilities/aw...
Re:Show HN: An eBook with hundreds of GNU Awk one-liners by asicsp on Thursday April 02, 2020 @09:22PM (#22765560)
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...

Re:Show HN: An eBook with hundreds of GNU Awk one-liners by fernly on Friday April 03, 2020 @01:21AM (#22766493)
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/

Re:Show HN: An eBook with hundreds of GNU Awk one-liners by calvinmorrison on Thursday April 02, 2020 @07:47PM (#22765051)
Re:Show HN: An eBook with hundreds of GNU Awk one-liners by exikyut on Thursday April 02, 2020 @08:36PM (#22765324)
Re:Show HN: An eBook with hundreds of GNU Awk one-liners by 7thaccount on Thursday April 02, 2020 @04:11PM (#22763180)
There is a perl oneliners book from nostarch press
Re:Show HN: An eBook with hundreds of GNU Awk one-liners by Scarbutt on Thursday April 02, 2020 @11:13PM (#22766039)
It takes way less time to learn awk than perl.
Re:Show HN: An eBook with hundreds of GNU Awk one-liners by collyw on Friday April 03, 2020 @03:20AM (#22766953)
Yes, but I already know Perl. I assume more people know Perl than AWK, but maybe that's a bias from places I worked.