Harder filtering, HELP ME PLEASE

Hi,

I wrote a post last friday but i think that i have not explained well.

I need help with shell script commands to filter information from a text file. This text file is divided into subsections of several lines that begin with a date as a header. There are no blank lines.

The aim is to create a script that receives as input parameter a date and ID number, and it shows only the parragraphs who start whit this date and contains in one of their lines the ID number. �Does anyone know how I can filter out entire paragraphs containing a certain string? I thought of using SED or AWK. THANKS

Yes, Pls post the input the desired output data.

Original file:

2009-11-10 09:32:13:TextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextText^tracking^=^id^="Pqe86V0prHWvSk5zfUD4KqEHaE"Te
2009-11-10 09:32:13TextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
Text^tracking^={^id^="n-Krg4-/r/VE5zfVD4EHaE"TextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
2009-11-10 09:32:13Text^tracking^{^id^="TA1vf/kCrHWyzfTD4KqEHaE"
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText

Output (finding ID: "n-Krg4-/r/VE5zfVD4EHaE"):

2009-11-10 09:32:13TextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
Text^tracking^={^id^="n-Krg4-/r/VE5zfVD4EHaE"TextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText

If there are more paragraphs with this ID would show all

awk  'BEGIN {RS="2009-11-10"}  /n-Krg4-\/r\/VE5zfVD4EHaE/ {print "2009-11-10"$0}' urfile

Thank you very much rdcwayx, but i have a problem, the date can appear behind the text in the parragraph and the output is not right. One solution would be put in the RS "^ 2009-11-10" to capture those dates that appear in the top of the line but I think AWK doesn't let to put regular expressions in the RS field and server does not have GAWK. I got insert with SED a blank line between parragraphs: cat file | sed '/^2009-11-10/{x;p;x;}' , and the new file looks like this:

2009-11-10 09:32:13:TextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextText^tracking^=^id^="Pqe86V0prHWvSk5zfUD4KqEHaE"Te

2009-11-10 09:32:13TextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
Text^tracking^={^id^="n-Krg4-/r/VE5zfVD4EHaE"TextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText

2009-11-10 09:32:13Text^tracking^{^id^="TA1vf/kCrHWyzfTD4KqEHaE"
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText
TextTextTextTextTextTextTextTextTextTextTextTextTextTextTextTextText

Can you think of something? Thank you

The rules for these forums are quite clear. Do not post questions with childish "Please Help Me" in the subject.

Everyone who comes here is seeking help.

Follow forum rules or do not post here.