Displaying text till pattern match found in a line

Hi All,
From the below line if we want to display all the text till found pattern dot/. I was trying with the below code but couldn't able
to print text before the pattern. it display texts which is found after pattern.

awk '/[Pp]assed/{print;getline;print}' file_name | sed 's/^[^:]*. *//'

input line from the file_name looks like

U12-C02: Software checks is passed. (Latest Software version : IED-2011-S : upgrade_01 4.13.2 (4.10.15_TREP-RT_13.31))

Currently it is displaying like this :

Software checks is passed. (Latest Software version : IED-2011-S : upgrade_01 4.13.2 (4.10.15_TREP-RT_13.31))

expected output should be like this :

U12-C02: Software checks is passed.

Many Thanks,
Optimus

awk -F"." '/[Pp]assed/{print $1 FS}' file
1 Like
 
awk '{for(i=1;i<=NF;i++){if($i ~ /[pP]assed/){s=s?s" "$i:$i; print s;s="";next}else{s=s?s" "$i:$i;}}}' file
awk -F '.'   '/[Pp]assed/{print $1 ;getline;print $1}' file_name

If you display several line of text from you input file, maybe we can do better than just guess as to what we we're reading. I do not see why you have getline in there. Your expected output is just a single line, per your example.

Thanks Franklin. It works fine.