Live data from Hacker News

Perl first commit: a “replacement” for Awk and sed

github.com

141–150 of 261 posts

Re: Perl first commit: a “replacement” for Awk and sed

#141

When perl came out we were living in horrific times. You had the choice of either Bourne, C or Korn shell. Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. Perl in one stroke collapsed the programming of C, text manipulation, the capabilities of all of the Unix utilities, an…

    # Sometimes I wake up screaming.  Famous figures are gathered in the nightmare,
    # Steve Bourne, Larry Wall, the whole of the ANSI C committee.  They're just
    # standing there, waiting, but the truely terrifying thing is what they carry
    # in their hands.  At first sight each seems to bear the same thing, but it is
    # not so for the forms in their grasp are ever so slightly different one from
    # the other.  Each is twisted in some grotesque way from the other to make each
    # an unspeakable perversion impossible to perceive without the onset of madness.
    # True insanity awaits anyone who perceives all of these horrors together.
https://github.com/openembedded/openembedded/blob/fabd8e6d07...

Re: Perl first commit: a “replacement” for Awk and sed

#142
post #55
post #42

Earlier quoted context omitted.

> Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. This doesn't sound that horrific to me. It's the classic Unix approach of building small tools that do one thing well, and composing them in novel ways to solve problems. For any problem that can't be solved this way you wri…

At the time, before everything became Linux, all these tools and the shells used to glue them together were an incoherent mess. Was your glue sh, ksh, csh, tcsh, bash or something uncommon like zsh? Did your grep, awk and sed use the same regexp syntax as your text editor? Single letter command line options, all meaning something different to each tool. Dozens of domain specific languages (shells, awk, sed etc.) mean…

> or something uncommon like zsh

By the time our lord and savior zsh appeared on the scene Perl was already at Perl 3. And, to be fair, I do not think many used zsh before 2.1 which was some time 1991 fall and by then the Camel Book was out for half a year or something like that. So the pre-Perl and the we-use-zsh days do not really overlap.

When Perl appeared the absolute hotness was the version of Korn shell what later became known as ksh88. https://github.com/weiss/original-bsd/tree/master/local/tool...

Re: Perl first commit: a “replacement” for Awk and sed

#143
Reading this summarizes my feelings on what kind of new language we need.

Something that makes workloads usually delegated to find, grep, sed and awk coherent and easy to use, allows streaming data between functions/commands and can still be used to glue things together.

Can I use Perl instead of bash/as my command line ? Should I start learning Perl?

Re: Perl first commit: a “replacement” for Awk and sed

#144

When perl came out we were living in horrific times. You had the choice of either Bourne, C or Korn shell. Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. Perl in one stroke collapsed the programming of C, text manipulation, the capabilities of all of the Unix utilities, an…

For me in the current day, perl is too much like "real programming", while I'm fairly comfortable with grep and sed, and to a lesser extent, awk. Piping a bunch of stuff together is just easier to understand and gradually expand. One thing I do in a lot of scripts is read from and write to the clipboard, usually transforming text with sed and co. Stuff like turning YouTube shorts URLs into regular ones, taking just the last directory name from a long file path on my clipboard, making my clipboard lowercase, etc.

I barely get into loops and lists when trying to learn Python before losing interest/focus and not trying again for months. It feels very abstract and like it's not useful for day-to-day stuff without learning and writing a lot. Shell stuff is very short and powerful and feels more grounded in reality. To be clear, I am not using if/else and the like in my shell scripts either. Usually they're just a few lines with little to no logic, but they're immensely useful. I can't imagine learning perl and then using it for all this stuff.

Re: Perl first commit: a “replacement” for Awk and sed

#145

When perl came out we were living in horrific times. You had the choice of either Bourne, C or Korn shell. Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. Perl in one stroke collapsed the programming of C, text manipulation, the capabilities of all of the Unix utilities, an…

A single-executable perl5 (like awk, but with advanced string manipulation + sigils + timtowdy madness) would be great.

Re: Perl first commit: a “replacement” for Awk and sed

#146
post #120

When perl came out we were living in horrific times. You had the choice of either Bourne, C or Korn shell. Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. Perl in one stroke collapsed the programming of C, text manipulation, the capabilities of all of the Unix utilities, an…

And now you can just use PowerShell which combines it all in one cross platform scripting language.

Cross-platform? I guess technically it is...

Re: Perl first commit: a “replacement” for Awk and sed

#147
post #69

Earlier quoted context omitted.

it's not about stats but simply that the space between simple shell scripts and complex systems that required "big" language, which used to be filled by perl has shrunk a lot because it is filled with many other languages that are better suited for larger systems than perl is. for most uses of perl today there are a dozen other suitable languages, including some that are older than perl but were not freely available…

>for most uses of perl today there are a dozen other suitable languages, including some that are older than perl but were not freely available at the time. Can you name some? I'm guessing Rexx is one of those you mean.

i am talking about the popular classics that have also been mentioned in other comments here, python, ruby, php, and several others that came after them.

with the older ones i mean languages like lisp and smalltalk which didn't become available for free or even usable on PCs until the 90s

i am not saying that they are all replacing perl, but that perl was used in areas where they are better suited, and with their appearance perl is no longer needed in those areas, hence the usage space for perl shrunk a lot.

Re: Perl first commit: a “replacement” for Awk and sed

#148

When perl came out we were living in horrific times. You had the choice of either Bourne, C or Korn shell. Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. Perl in one stroke collapsed the programming of C, text manipulation, the capabilities of all of the Unix utilities, an…

> Yes, awk and sed were replaced by Perl, but more importantly, the unmaintainable nightmare that glued all of it together was wiped out. Er, Perl replaced an unmaintainable nightmare? Perl, the language infamous for being indistinguishable from line noise?

All nontrivial sed programs are line noise, there is no other way to program in it. In Perl you at least have a chance. Awk is not much more readable than Perl actually.

Re: Perl first commit: a “replacement” for Awk and sed

#149
post #129

Earlier quoted context omitted.

> This doesn't sound that horrific to me. It's the classic Unix approach of building small tools that do one thing well, and composing them in novel ways to solve problems. This works really well if your problem can be solved in one or two liners. It go bad very quickly when, say, you have two CSV files and want to join them the sql-way. In sed, you have to use positional variables and think about shell escaping. In…

> This works really well if your problem can be solved in one or two liners. My personal comfort threshold is around the 100-line mark. It's even possible to write maintainable shell scripts up to 500 lines, but it mostly depends on the problem you're trying to solve, and the discipline of the programmer to follow best practices (use sane defaults, ShellCheck, etc.). > It go bad very quickly when, say, you have two C…

You’re discussing modern tooling in a conversation about early UNIX tooling. Back in the period being discussed, even ‘read’ was less functional. Ksh introduced a lot of the stuff we now take for granted, some of which wasn’t even available until the Ksh93 (long after Perl was released). Bash itself is a younger project than Perl. Albeit not by much.
Post reply on HN