Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Fwd: playing with IFS





On 2026-04-13 08:53, Mark J. Reed wrote:

On Sun, Apr 12, 2026 at 10:47 PM dana <dana@xxxxxxx> wrote:
i don't see the difference
The first one tries to put expansion flags in {} instead of (). That's nothing to do with spaces, Ray. It's always ${(flags)...} - curlies on the outside, parens on the inside. 
I know it.  A simple typo.  Cost me hours trying to figure out what was wrong :(  Just a lazy eye.
.
As for this:

     sed -r 's/(\x1b\[K[:-]\x1b\[m\x1b\[K)[[:space:]]*/\1 /g' 

Even if you stick with sed you might prefer an ANSI string version of the command:

     $'s/(\e\\[K[:-]\e\\[m\e\\[K)[ \t]*/\\1 /g'
What an improvement!  That $' ' quoting ... still don't understand it or use it.  This is all mods to grep colorizations, which are so overloaded with superfluous codes -- but I'm told that grep is extra careful due to the fact that some terminals might need them.  Still, I'd take native zsh code if it would work -- no pipes, no '<<<', no '$()'.  All this sed stuff -- good example of 'write only' code -- I know what it means when I write it, but an hour later it's gibberish.  

BTW point of it is to remove leading spaces from grep lines.  Quite nice.

https://drive.google.com/file/d/1175Pjfx0RTjs5vbA9yqx62eOwg-4jnxW/view?usp=sharing



Messages sorted by: Reverse Date, Date, Thread, Author