3 ms·
yeah.. I like the `s///` syntax in sed/perl than the `sub/gsub` syntax.. plus the regex is lacking in awk.. no backreference(gawk provides, but only in replacem
by asicsp 8y ago
yeah.. I like the `s///` syntax in sed/perl than the `sub/gsub` syntax.. plus the regex is lacking in awk.. no backreference(gawk provides, but only in replacement section).. and perl has non-greedy, lookarounds, code in replacement section, etc
other nice features I'd like in awk is `tr` and `join`
- ams6110 8y agoWhy add 'tr' and 'join' to awk when they exist on their own? That's part of why people avoid perl. It's very capable, but that wide scope is counter to the unix philosophy that prefers simple, focused utilities that can be combined in pipelines.
- asicsp 8y agolooks like I didn't word it properly... you could ask why have sub/gsub when there is sed... that's because you need that for specific field or string in addition to other processing.. similarly, having tr for specific string/field is useful.. I meant join as in perl's join - to construct a string out of array values with specified separator Some examples: * https://stackoverflow.com/questions/48920626/sort-rows-in-csv-file-without-header-first-column https://stackoverflow.com/questions/48920626/sort-rows-in-cs... * https://stackoverflow.com/questions/45571828/execute-bash-command-inside-awk-and-print-command-output https://stackoverflow.com/questions/45571828/execute-bash-co... * https://stackoverflow.com/questions/48925359/sorting-groups-of-lines https://stackoverflow.com/questions/48925359/sorting-groups-...