We help IT Professionals succeed at work.
Get Started

SED: print lines from $DATE to end of file

Last Modified: 2013-12-26

I need help as I just can't make it work.
In a file I need all lines from 'date' written as 07/11/10 to end of file.

Date variable is written as:
DATE=`date '+%m/%d/%y'`
which outputs the correct format.

Normal notation for what I want would be:
sed -n '/regex/,Sp' in > out

Replacing the regex with $DATE:
sed -n '/$DATE/,Sp' in > out
won't work however, no matter how much I tried using single/double quotes, other seperators than /, working with \ as escape character, ....

I'm at a loss, 'date' is the only relevant criterium to select upon.
From attached file only lines starting from 07/11/10 till end of file should be retained.

Any alternative (for sed) that works is welcome too.
Platform is hpux with ksh.

Thanks for  your help.

Watch Question
Top Expert 2007
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE