I have a text file containing both text and numbers, I want to use grep to extract only the numbers I need for example, given a file as follow:
miss rate 0.21
ipc 222
stalls n shdmem 112
So say I only want to extract the data for miss rate
which is 0.21
. How do I do it with grep or sed? Plus, I need more than one number, not only the one after miss rate
. That is, I may want to get both 0.21
and 112
. A sample output might look like this:
0.21 222 112
Cause I need the data for later plot.