Re: Fwd: playing with IFS
"Mark J. Reed" <[email protected]> Mon, 13 Apr 2026 12:56:08 -0400
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAA=-s3zAe9MZFfg7Lm9etcLoS6C-4TkkSkgMGOKVQpeED8LSOw@mail.gmail.com> |
If you are capturing the output of grep in a variable it won't do any coloring at all unless you force it with --color=always. I would normally leave it off when operating grep programmatically... not sure why you'd want to capture it. On Mon, Apr 13, 2026 at 12:50 PM Ray Andrews <[email protected]> wrote: > > > On 2026-04-13 08:53, Mark J. Reed wrote: > > > On Sun, Apr 12, 2026 at 10:47 PM dana <[email protected]> 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 > > -- Mark J. Reed <[email protected]>