I am trying to have the command run to extract a range of dates from a file and print them
ex: sed -ne ‘/^2009-08-20/,/^2009-08-26/p’
Yet I have multiple occurances of 2009-08-26 in the file, I want all of them to return, yet it only returns the first one. Is it possible to have ALL return?
Thanks!
sed -ne ‘/^2009-08-20/,/^2009-08-26/b e;/^2009-08-26/b e;d;:e p’
To explain: ‘e’ is a label and if you are in the range you branch to that label. You give a second chance and you check if it is the end of the range. If not, delete the line.