[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Printing sections from files with sed
From: |
Hans Lonsdale |
Subject: |
Re: Printing sections from files with sed |
Date: |
Tue, 31 Jan 2023 08:28:05 +0100 (CET) |
> ----------------------------------------
> From: Kerin Millar <kfm@plushkava.net>
> Date: Jan 31, 2023, 7:18:52 PM
> To: Hans Lonsdale <hanslonsdale@mailfence.com>
> Cc: Help Bash <help-bash@gnu.org>
> Subject: Re: Printing sections from files with sed
>
>
> On Tue, 31 Jan 2023 07:49:02 +0100 (CET)
> Hans Lonsdale <hanslonsdale@mailfence.com> wrote:
>
> > Here I set the matching patterns and call sed
> >
> >
> > pn_ere='^[[:space:]]*([#;!]+|@c|//)[[:space:]]'
>
> This contains unescaped slashes.
>
> > beg_re="${pn_ere}${faml} \[${asmb}\][[:space:]]*$"
> > end_re="${pn_ere}END OF ${faml} \[${asmb}\][[:space:]]*$"
> >
> > sed -n "/$beg_re/,/$end_re/ {
> > /$beg_re/d ; /$end_re/z; s/${pn_ere}// ; p
>
> The s command here is using the slash as a delimiter.
I understood your discussion except this one. How am I using slash as
delimiter?
> Additionally, sed expects BREs unless given the -E option.
>
> --
> Kerin Millar
>
--
Sent with https://mailfence.com
Secure and private email