Bash - an odd problem using sed or awk or for

John Horne john.horne at plymouth.ac.uk
Sun Dec 2 20:41:53 UTC 2012


On Sat, 2012-12-01 at 23:25 -0430, Patrick O'Callaghan wrote:
> On Fri, 2012-11-30 at 21:37 -0700, Greg Woods wrote:
> > On Thu, 2012-11-29 at 23:33 +0000, John Horne wrote:
> > 
> > > ============ (the '=' are not part of the variable)
> > > abc def
> > > 
> > > hijk
> > > xyz
> > > ============
> > > 
> > > So in this case what is wanted is:
> > > 
> > > ============
> > > hijk
> > > xyz
> > > ============
> > > 
> > > to be shown.
> > 
> > echo "$XX" | sed -e '1,/^$/d'
> 
> This will delete lines up to and including the first blank line. The
> OP's problem statement isn't very clear, but I think he wants to delete
> everything up to and including the last blank line, if any.
> 
Correct.



John.

-- 
John Horne, Plymouth University, UK
Tel: +44 (0)1752 587287    Fax: +44 (0)1752 587001



More information about the users mailing list