News for hackers. Stuff that matters.
Re:Useful sed scripts and patterns by Debug_Overload on Friday November 12, 2021 @01:59AM (#29196956)
How long does the relearning take exactly? My experience has been that if you've used these tools before, it's pretty easy to remember or refresh your memory. In that sense, they're not very different from other tools/syntaxes that you haven't used in a while.

And if you do use them frequently enough, you might not even need to refresh/relearn anything.

Re:Useful sed scripts and patterns by baby on Friday November 12, 2021 @02:39AM (#29197144)
I basically gave up on relearning them considering the number of times I’ve had to do it and the amount of effort involved to relearn them. Maybe it’s just me, but I just write python now.
Re:Useful sed scripts and patterns by ivanhoe on Friday November 12, 2021 @03:15AM (#29197278)
Makes sense if python is what you otherwise use for everyday work, it's always easiest if you can avoid context switching.

To me it's bash, sed and awk for the basic text-processing things, and then perl for anything that requires more programming. These are very similar syntaxes (and ways of thinking I'd say), so they fit together great - and also are close enough to php and js that I do at work to make the transition painless. But if I had to write it in python or ruby or God forbid C++ - which all I used a lot, but long time ago - I'm sure it would be a big struggle for me now.

Re:Useful sed scripts and patterns by chasil on Friday November 12, 2021 @10:16AM (#29200031)
The full specification for the AWK language is 40 pages in the book written by the authors.

I sometimes forget the exact syntax for pipes and file open/close, but it's not hard to find in 40 pages.

AWK is in busybox, and a lot of other places that Python simply cannot go.

The control structure syntax is also the same a C/JavaScript/PHP/C++ etc., so it certainly does not hurt to know it.

https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_P...

Re:Useful sed scripts and patterns by sam_lowry_ on Friday November 12, 2021 @02:59AM (#29197214)
You need to have a mental model for each tool and some idea of syntax associated with it. Once I learned about IFS,OFS, BEGIN, END and {}, as well as the fact that variables and their references have the same syntax, unlike in Perl... I could pick up coding in awk at any moment
Re:Useful sed scripts and patterns by kbenson on Friday November 12, 2021 @12:14PM (#29201822)
Perl has BEGIN and END as well, and when using it with -n or -p for line processing mode uses -F to set word boundaries just like awk. In fact, it shared many flags and features with awk, which it was meant to be able to be used as a more powerful version of the same tool.
Re:Useful sed scripts and patterns by chasil on Friday November 12, 2021 @10:17AM (#29200041)
IFS is the POSIX shell; in awk, it's just FS.

I think by {} you mean an argument to the find command.

Re:Useful sed scripts and patterns by sam_lowry_ on Saturday November 13, 2021 @05:18AM (#29208797)
Indeed. Thanks for the hint.