I use
cmd | egrep 'ID|Value'
andget the following output on my command line:
ID: 2
Value: 21
ID: 1
Value: 25
ID: 1
Value: 22
ID: 3
Value: 56
ID: 1
Value: 23
ID: 2
Value: 50
ID: 2
Value: 56
ID: 3
Value: 11
ID: 3
Value: 26
I would like to filter it by one special ID. But when I use:
egrep 'ID: 1|Value'
It will show the same output with just ID 1, but the Values of all IDs.
I already read about awk, sed and regex, but i can't find anything that would really help me, but I'm also not that deep into that.
Someone can suggest an idea, or tell me that it's the wrong way to approach it and I should do it differently and how?
Output as wanted:
ID: 1
Value: 25
ID: 1
Value: 22
ID: 1
Value: 23