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

Re: autoload variables



Hi Roman,

Le Tue, Aug 31, 2021 at 11:03:39PM +0200, Roman Perepelitsa a écrit :
>   sed -n -e '/^default/ s/^default.*dev //; s/ .*// p;q'

> In plain English:

english is fine. can you confirm that '/^default/ s/^default.*dev //'
is a suttered way to say              's/^default.*dev //' ?

>   2. If a portion of the line matches '^default.*dev', remove it

i realize i assumed in the first place that 'default dev' was the only
valid part but i just saw there can be a 'via something' subpart.

>   1. Take the first line.

that's what i was afraid about. does ip r garanty that? my version was

sed '
    /^default.*dev /!d # do nothing until you find a match
    # so the next commands applies only on the valid line
    s///d              # remove what you just found
    s/ .*//d           # remove the tail of the sentence
    q                  # print and quit
'

Regards
marc




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