How to grep 192.168.1.2 IP with port 5241 or 25 or 445?
Input:
192.168.1.1:33
192.168.1.2:5241
192.168.1.3:22
192.168.1.2:25
192.168.1.2:80
192.168.1.2:445
192.168.1.2:40
Expected output:
192.168.1.2:5241
192.168.1.2:25
192.168.1.2:445
CodePudding user response:
You need to use regular expressions. Here's what I came up with:
grep "^192.168.1.2:\(5241\|25\|445\)" input.txt