[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] m_getfld() bug fix

From: Ralph Corderoy
Subject: Re: [Nmh-workers] m_getfld() bug fix
Date: Sun, 08 Dec 2013 10:47:08 +0000

Hi again David,

> I wonder if `diff -b' is the wrong approach as it's applying the -b to
> the whole file.  Would using sed to canonicalise that one line to no
> spaces at start or end, and only one space in between be better?

Something like

    sed '/<div>/n; /Need/!n; s/   */ /g; s/^ //; s/ $//'

If the line contains "<div>", start again with the next one.
If the line doesn't contain "Need", start again with the next one.
# We're now on the non-<div> Need line.
Replace runs of two or more spaces with a single space.
Remove any leading single space.
Ditto trailing.

Cheers, Ralph.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]