1

Getting value of a pattern preceding another pattern

view story
linux-howto

http://www.unix.com – I have a file like this ------------------------------- [2012-11-12 : 11:59 some text some moe text ERR-XXXXX soe more text ] [2012-11-12 : 12:00 blala blah blah] [2012-11-12 : 12:01 some text some moe text ERR-XXXXX soe more text ] [2012-11-12: 12:02 some other text ] -------------------------------------- I need a way to find the timestamp preceding the ERR-XXXXX Here XXXX deonoes any any numeric string 00000-99999 that is a output like this 2012-11-12 : 11:59-ERR-XXXXX 2012-11-12 : 12:01-ERR-XXXXX (HowTos)