awk remove line

I would like to remove lines with certain pattern but only Estimate: and Realised: in USD and Date: shall be output. The order of the currency are mixed.

Output

I failed on awk with sub, gensub and was not able to remove the multiple entry on the * Date:

Show us your attempts!

---------- Post updated at 15:41 ---------- Previous update was at 15:36 ----------

Howsoever, try

awk '/Estimate|realized/ {printf "%s%s ", $1, FS} /USD|Date:/' FS=":" file
Estimate:USD 8'906.31
* Date: 2013-12-06
USD 6'679.73
* Date: 2013-12-06
Price realized:USD 8'906.31
* Date: 2013-12-06 

---------- Post updated at 15:43 ---------- Previous update was at 15:41 ----------

Before you complain about the multiple "Date" lines - you didn't give us any means to tell one of those from the others...

1 Like

Thanks, thats what I needed. Double dates are not serious.