I am trying to locate two strings in a single line. Below is the example line.
line1: xxxx yyyy time1-12 zzzz time2-13
line2: xxxx yyyy time1-14 zzzz time2-15
I am using the below grep command to achieve this
grep -o -E 'time1-[0-9]*|time2-[0-9]*' timetest.txt
This is giving me the output as
time1-12
time2-13
time1-14
time2-15
But i want like this
time1-12 time2-13
time1-14 time2-15
What i am missing here? Can i go for awk or sed for getting this output
awk '{print $4 " " $6}' timetest.txt