Hi,
I have this raw data:
maria olan 4
olan maria 5
maria danie 9
danie maria 10
Based from this data, I can say that "maria olan 4" and "olan maria 5" lines are pair. I did create a simple awk that would display either of these lines showing the one with the maximum value in the last column. In this case, it would be "olan maria 5".
This is the awk command I created:
Ii just need an easy way to feed a variable in my regex, example in this case is /olan maria|maria olan/.
Hope somebody can help me.
Many thanks!
I have this raw data:
maria olan 4
olan maria 5
maria danie 9
danie maria 10
Based from this data, I can say that "maria olan 4" and "olan maria 5" lines are pair. I did create a simple awk that would display either of these lines showing the one with the maximum value in the last column. In this case, it would be "olan maria 5".
This is the awk command I created:
Code:
cat file | awk '/olan maria|maria olan/ {print $0}' | \
awk '$3 > max {max=$3; maxline=$0}; END{ print maxline}'
Ii just need an easy way to feed a variable in my regex, example in this case is /olan maria|maria olan/.
Hope somebody can help me.
Many thanks!