• lisp scripts

    From zara@21:1/5 to All on Sun Feb 9 06:49:45 2025
    Hi,

    wanted to learn shell using sed and awk as in the O'Reilly book.

    I am working on scripts in Common Lisp using shell inside,
    here's the link to the code, it's GPL2 :

    http://sf.net/projects/lisp-scripts

    Zara

    --
    My software & art company : http://ko-fi.com/brandywine9

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to zara on Sun Feb 9 06:28:23 2025
    On 2025-02-09, zara <johan@freecol.be> wrote:
    Hi,

    wanted to learn shell using sed and awk as in the O'Reilly book.

    It will work better if you learn the shell language using
    a shell.

    sed and awk commands have a lot of details that are particular
    to those utilities.

    When invoking those utilities from a shell command, you have to
    understand how to quote the body of the awk or sed program properly so
    that it's handled intact as a single argument, without the shell itself interpreting any special characters.

    I am working on scripts in Common Lisp using shell inside,
    here's the link to the code, it's GPL2 :

    http://sf.net/projects/lisp-scripts

    In 2025, nobody is going to download and unpack tarballs you posted to sourceforge to look at your code.

    You might as well scratch it on the wall of your cave with a piece of
    charcoal, and invite people to peruse it by the light of a torch.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Randal L. Schwartz@21:1/5 to All on Sun Feb 16 01:05:06 2025
    "Dan" == Dan Cross <cross@spitfire.i.gajendra.net> writes:

    I'm sure he does, I'm sure it was meant in jest, and
    I'm sure that Randal took it as such.

    I did. Slight chuckle, but I'm nearly blind to any knee-jerk "Perl is
    bad" text.

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Dart/Flutter consulting, Technical writing, Comedy, etc. etc.
    Still trying to think of something clever for the fourth line of this .sig

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sun Feb 9 17:17:41 2025
    On 09.02.2025 11:26, Keith Thompson wrote:
    Kaz Kylheku <643-408-1753@kylheku.com> writes:
    On 2025-02-09, zara <johan@freecol.be> wrote:
    [...]
    I am working on scripts in Common Lisp using shell inside,
    here's the link to the code, it's GPL2 :

    http://sf.net/projects/lisp-scripts

    In 2025, nobody is going to download and unpack tarballs you posted to
    sourceforge to look at your code.

    You might as well scratch it on the wall of your cave with a piece of
    charcoal, and invite people to peruse it by the light of a torch.

    :-)

    Consider putting your code on GitHub instead.

    On 09.02.2025 07:28, Kaz Kylheku also wrote:

    In 2025, nobody is going to download and unpack tarballs youposted to sourceforge to look at your code.

    In my opinion, if some code is advertised in Usenet then there should
    be sufficiently complete information about it posted here to know what
    any remote link is (and less of "I've done something, and you find it
    there").

    If you have enough information about the advertised product it's IMO a
    still not unimportant but secondary question where it's placed.

    And if there's enough information here I can decide whether I take the
    burden to access Github or anything else.

    I ignore such posts that contain only links and spare the information (including rationales etc.).

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to dan1espen@gmail.com on Sun Feb 9 16:46:24 2025
    In article <voajsf$nd2k$1@dont-email.me>,
    Dan Espen <dan1espen@gmail.com> wrote:
    ...
    ... to Perl.
    ... something any programmer could readily understand.

    I'm sure opinions will vary on that.

    Now I'd use Python.

    Gotta keep up with the fashion world, doncha?

    --
    Kenny, I'll ask you to stop using quotes of mine as taglines.

    - Rick C Hodgin -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Dan Espen on Sun Feb 9 19:02:58 2025
    On 09.02.2025 18:21, Dan Espen wrote:
    gazelle@shell.xmission.com (Kenny McCormack) writes:

    In article <voajsf$nd2k$1@dont-email.me>,
    Dan Espen <dan1espen@gmail.com> wrote:
    ...
    ... to Perl.
    ... something any programmer could readily understand.

    I'm sure opinions will vary on that.

    They guy that wrote the sed/awk stuff agreed.

    Curious; do you mean the authors of those languages or the
    authors (pl.) of that unspecific mentioned "sed & awk" book?

    Given clarity/cryptically of syntax (and their semantics)
    these three languages (Awk, Perl, Sed) for sure vary a lot!

    Janis


    Now I'd use Python.

    Gotta keep up with the fashion world, doncha?

    Oh, I'm hurt.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Dan Espen on Mon Feb 10 00:00:15 2025
    On Sun, 09 Feb 2025 11:07:43 -0500, Dan Espen wrote:

    I once spent a week converting a LOT of sed/awk to Perl. I turned a complicated mess into something any programmer could readily understand.
    (And actually worked.)

    I have pointed out several times that Perl does everything awk can do, at
    least as concisely, and a lot more besides. Which is why I never bothered
    to learn awk.

    Some people get annoyed every time I say that.

    Now I'd use Python.

    With Perl, I was never quite sure I fully understood what was going on.
    There was always some hint of magic lurking just behind the scenes. Also
    the core language ends up quite large, with all the built-in features
    packed into it.

    (Those two characteristics are probably related.)

    With Python, I always felt that I understood what I was doing. And I kept
    that feeling as I got into more complex features like descriptors and metaclasses. It is, for the most part, a language whose growth has been carefully managed, so that the language core remains compact and cohesive
    and yet remains an incredibly powerful base to build on (as the standard library demonstrates).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Janis Papanagnou on Mon Feb 10 02:09:42 2025
    On 10.02.2025 02:06, Janis Papanagnou wrote:

    [...], but Shell as well cat gen quite messy if you want to write [...]

    So far for applied cryptography; that should have been

    [...], but Shell as well can get quite messy if you want to write [...]

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Dan Espen on Mon Feb 10 02:06:28 2025
    On 09.02.2025 22:56, Dan Espen wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 09.02.2025 18:21, Dan Espen wrote:
    gazelle@shell.xmission.com (Kenny McCormack) writes:

    In article <voajsf$nd2k$1@dont-email.me>,
    Dan Espen <dan1espen@gmail.com> wrote:
    ...
    ... to Perl.
    ... something any programmer could readily understand.

    I'm sure opinions will vary on that.

    They guy that wrote the sed/awk stuff agreed.

    Curious; do you mean the authors of those languages or the
    authors (pl.) of that unspecific mentioned "sed & awk" book?

    Given clarity/cryptically of syntax (and their semantics)
    these three languages (Awk, Perl, Sed) for sure vary a lot!

    This was an app developed by one of my co-workers.
    The app consisted of many shell scripts and many invocations of
    awk and sed. There were dozens of files in the app. I was trying to
    fix it and worked on it for quite some time before I decided it was too
    many files and too many different languages being used.

    Ah, now I see what you meant...


    I ended up re-writing the whole thing as a single Perl script.
    The whole thing was all in one file and much easier to understand.
    As I said, the original author agreed.

    ...the author of that project, obviously.

    Yes, we can often observe that projects grow that way and that there
    are often far too many individual tools involved, and unnecessarily.
    If you use Awk anyway there's absolutely no need for using Sed. And
    with Perl you can also avoid the Shell/Awk glue and stay within one
    language.

    Reasons for Shell & Awk are that these are Unix standard and can be
    expected to exist "everywhere" to create portable scripting software.
    And Awk is also advantageous for its much clearer syntax (as opposed
    to Perl), but Shell as well cat gen quite messy if you want to write
    scripts functionally correct.

    (Python, that I think you mentioned elsthread, has it's own inherent
    quirks and has the same non-standard property as Perl.)

    It's the projects' choice to select the appropriate tool in any given
    context.


    Perl can be cryptic if you use the cryptic parts of the language.
    I don't.

    Perl has some inherent cryptic syntax; something that other languages (including Awk) don't have. And Sed is anyway "applied cryptography"
    par excellence.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Dan Espen on Tue Feb 11 00:01:04 2025
    On Mon, 10 Feb 2025 11:14:13 -0500, Dan Espen wrote:

    I was happily using Perl for a GUI I wrote using Perl/GTK.
    As GTK evolved, the Perl support got worse and worse. Eventually
    forcing me to move to Python/GTK.

    My first shot at GUI programming on Linux was using Tcl with Tk. This was
    just a bit before I discovered Python. I reworked that app to use Python
    with GTK, and it worked so much better, I never went back to Tcl again.

    Tk is still available for use with Python, and it still works through a
    Tcl layer to get there. That can be useful for some simple jobs, in spite
    of Tk’s deficiencies as a GUI toolkit.

    Since then I've found the number of interfaces from Python to other
    packages is just amazing.

    I think there is something about the design of Python that encourages the proliferation of such interfaces. The core language is compact (a fraction
    the size of Java, for example), yet versatile enough to be specialized for
    many domain-specific uses (e.g. it includes user-defined operator
    overloads, which Java had to leave out).

    And then there is the ctypes module, which lets you directly interface to compiled libraries written for C or other such low-level languages, just
    using pure Python code. And you can construct conveniently high-level “Pythonic” interfaces, to make it look like the library was written for
    use from Python, when it was not.

    There was a time when Perl was the go-to language for this sort of thing.
    I think Python won out because it managed to make the whole job easier.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Randal L. Schwartz@21:1/5 to dan1espen@gmail.com on Thu Feb 13 11:44:55 2025
    "Kenny" == Kenny McCormack <gazelle@shell.xmission.com> writes:

    Kenny> In article <voajsf$nd2k$1@dont-email.me>,
    Kenny> Dan Espen <dan1espen@gmail.com> wrote:
    Kenny> ...
    ... to Perl.
    ... something any programmer could readily understand.

    Kenny> I'm sure opinions will vary on that.

    If they don't understand the Perl code, I could recommend a couple of
    good books...
    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Dart/Flutter consulting, Technical writing, Comedy, etc. etc.
    Still trying to think of something clever for the fourth line of this .sig

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Randal L. Schwartz on Thu Feb 13 20:59:56 2025
    On 2025-02-13, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
    "Kenny" == Kenny McCormack <gazelle@shell.xmission.com> writes:

    Kenny> In article <voajsf$nd2k$1@dont-email.me>,
    Kenny> Dan Espen <dan1espen@gmail.com> wrote:
    Kenny> ...
    ... to Perl.
    ... something any programmer could readily understand.

    Kenny> I'm sure opinions will vary on that.

    If they don't understand the Perl code, I could recommend a couple of
    good books...

    That makes no sense. Don't you mean Perl books?

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Salvador Mirzo@21:1/5 to Kaz Kylheku on Thu Feb 13 20:11:38 2025
    Kaz Kylheku <643-408-1753@kylheku.com> writes:

    On 2025-02-13, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
    "Kenny" == Kenny McCormack <gazelle@shell.xmission.com> writes:

    Kenny> In article <voajsf$nd2k$1@dont-email.me>,
    Kenny> Dan Espen <dan1espen@gmail.com> wrote:
    Kenny> ...
    ... to Perl.
    ... something any programmer could readily understand.

    Kenny> I'm sure opinions will vary on that.

    If they don't understand the Perl code, I could recommend a couple of
    good books...

    That makes no sense. Don't you mean Perl books?

    :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eberhard W Lisse@21:1/5 to Lawrence D'Oliveiro on Fri Feb 14 23:51:57 2025
    On 10/02/2025 02:00, Lawrence D'Oliveiro wrote:
    On Sun, 09 Feb 2025 11:07:43 -0500, Dan Espen wrote:

    I once spent a week converting a LOT of sed/awk to Perl. I turned
    a complicated mess into something any programmer could readily
    understand. (And actually worked.)

    I have pointed out several times that Perl does everything awk can
    do, at least as concisely, and a lot more besides. Which is why I
    never bothered to learn awk.

    Some people get annoyed every time I say that.

    Now I'd use Python.
    [...]

    Python, Shmython. It's like whether vi or emacs is the better editor
    (of course Sublime Text is the better one :-)-O)

    Awk is very good for short one liners on reasonably short input files,
    because Perl takes longer to load.

    Perl is very good for large input files, a more complete programming
    language with gazillions of modules and around for ages.

    Python is probably as good as Perl or better and has gazillions of
    libraries. However this need for virtual environments and that scripts
    stop working after a Python upgrade, make things complicated and has
    turned me off from learning it, which I wanted to do as I have
    retired.

    Don't forget LUA :-)-O

    If you are young and want to learn a (new) programming language don't
    start with Perl, start with Python.

    If you have worked with Perl for ages, carry on I doubt there is
    anything in Python that you can't do in Perl.

    If there is a need to learn shell then learn shell (bash, zsh or
    whatever).

    I recently had to come up with a script that takes a DNS zone file, and constructs a really complicated CSV of 79 columns delimited with ';'
    and "pivoting" name servers from 'long' to 'wide' (but without
    aggregation) with the IP addresses concatenated to the names of the
    glue records, some of which didn't even have IP addresses.

    Perl script works quite will for smaller zones, but does not scale well.

    Bash script with QSV pipelines and DuckDB (for the 'pivoting') is
    extremely fast. So fast that I didn't try Perl with DuckDB.

    The Bash script is as readable as the Perl script because I tend to
    comment so much that I later can figure out what I did and why,
    myself :-)-O

    That's 11 cents from a retired Gynecologist :-)-O

    el

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eberhard W Lisse@21:1/5 to Kaz Kylheku on Fri Feb 14 23:31:36 2025
    On 13/02/2025 22:59, Kaz Kylheku wrote:
    On 2025-02-13, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
    [...]
    If they don't understand the Perl code, I could recommend a couple
    good books...

    That makes no sense. Don't you mean Perl books?

    Do you know who you are addressing?

    el

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Eberhard W Lisse on Fri Feb 14 23:14:21 2025
    On 14.02.2025 22:51, Eberhard W Lisse wrote:

    That's 11 cents from a retired Gynecologist :-)-O

    IT folks typically provide only 10 cents.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Cross@21:1/5 to nospam@lisse.NA on Fri Feb 14 23:00:11 2025
    In article <m19r1pFbvn8U1@mid.individual.net>,
    Eberhard W Lisse <nospam@lisse.NA> wrote:
    On 13/02/2025 22:59, Kaz Kylheku wrote:
    On 2025-02-13, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
    [...]
    If they don't understand the Perl code, I could recommend a couple
    good books...

    That makes no sense. Don't you mean Perl books?

    Do you know who you are addressing?

    I'm sure he does, I'm sure it was meant in jest, and
    I'm sure that Randal took it as such.

    - Dan C.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)