Re: grep replacement using sed is behaving oddly

2022-10-22 Thread Max Nikulin
On 22/10/2022 20:23, Gary Dale wrote:     sed -i '//d' *.html did the trick. I would suggest you to use more specific pattern to avoid removing of meaningful text due to a lost newline character: sed -i -e '/^\s*]*>\s*$/d' "." in regexp may be a source of surprises (or catastrophic backtr

Re: grep replacement using sed is behaving oddly

2022-10-22 Thread Gary Dale
On 2022-10-21 15:14, David Wright wrote: On Fri 21 Oct 2022 at 14:15:01 (-0400), Greg Wooledge wrote: On Fri, Oct 21, 2022 at 08:01:00PM +0200, to...@tuxteam.de wrote: On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: I'm hoping someone can tell me what I'm doing wrong. I have a line

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Sat, Oct 22, 2022 at 10:32:24AM +0700, Max Nikulin wrote: > On 22/10/2022 02:09, The Wanderer wrote: > > > > 'info sed', section 'sed regular expressions', subsection 'regular > > expression extensions': > > While a reader may find more interesting stuff lying around while traveling > by this

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Max Nikulin
On 22/10/2022 02:09, The Wanderer wrote: 'info sed', section 'sed regular expressions', subsection 'regular expression extensions': While a reader may find more interesting stuff lying around while traveling by this path, there is a shorthand info "(sed) regexp extensions" and alternatives

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread The Wanderer
On 2022-10-21 at 16:16, Greg Wooledge wrote: > On Fri, Oct 21, 2022 at 03:09:32PM -0400, The Wanderer wrote: > >> IOW, each seems to be half of the usual '\b' (edge of a word) set. >> With the default sed behavior (not sure whether that's basic >> regular expressions or extended regular expressio

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Greg Wooledge
On Fri, Oct 21, 2022 at 03:09:32PM -0400, The Wanderer wrote: > IOW, each seems to be half of the usual '\b' (edge of a word) set. With > the default sed behavior (not sure whether that's basic regular > expressions or extended regular expressions, in the nomenclature of the > info document), you c

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread David Wright
On Fri 21 Oct 2022 at 14:15:01 (-0400), Greg Wooledge wrote: > On Fri, Oct 21, 2022 at 08:01:00PM +0200, to...@tuxteam.de wrote: > > On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > > > I'm hoping someone can tell me what I'm doing wrong. I have a line in a > > > lot > > > of HTML file

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread The Wanderer
On 2022-10-21 at 14:15, Greg Wooledge wrote: > So... yeah, \< and/or \> clearly have some special meaning to GNU > sed. Good luck figuring out what that is. 'info sed', section 'sed regular expressions', subsection 'regular expression extensions': >> '\<' >> Matches the beginning of a word.

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Fri, Oct 21, 2022 at 02:15:01PM -0400, Greg Wooledge wrote: > On Fri, Oct 21, 2022 at 08:01:00PM +0200, to...@tuxteam.de wrote: > > On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > > > I'm hoping someone can tell me what I'm doing wrong. I have a line in a > > > lot > > > of HTML fi

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Greg Wooledge
On Fri, Oct 21, 2022 at 08:01:00PM +0200, to...@tuxteam.de wrote: > On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > > I'm hoping someone can tell me what I'm doing wrong. I have a line in a lot > > of HTML files that I'd like to remove. The line is: > > > >     > > > > I'm t

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Fri, Oct 21, 2022 at 01:50:29PM -0400, Greg Wooledge wrote: > On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > >  sed -i -s 's/\s*\//g' history.html > > > > Unfortunately, the replacement doesn't remove the line but rather leaves me > > with: > > > >     <;"> > > The 's' c

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > I'm hoping someone can tell me what I'm doing wrong. I have a line in a lot > of HTML files that I'd like to remove. The line is: > >     > > I'm testing the sed command to remove it on just one file. When it works, > I'll run

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Greg Wooledge
On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: >  sed -i -s 's/\s*\//g' history.html > > Unfortunately, the replacement doesn't remove the line but rather leaves me > with: > >     <;"> The 's' command in sed doesn't remove lines. It performs a substitution within a line. T

grep replacement using sed is behaving oddly

2022-10-21 Thread Gary Dale
I'm hoping someone can tell me what I'm doing wrong. I have a line in a lot of HTML files that I'd like to remove. The line is:     I'm testing the sed command to remove it on just one file. When it works, I'll run it against *.html. My command is:  sed -i -s 's/\s*\//g' history.ht