Extract a text between delimiters with sh instead of using regex
Example file:
UNKNOWN[123.21.181.4]
abts-tn-dynamic-161.155.174.122.airtelbroadband.in[122.174.155.161]
fm-dyn-118-137-18-160.fast.net.id[118.137.18.160]
UNKNOWN[118.69.71.76]
ip-177.71.93.43.juniornet.psi.br[177.71.93.43]
UNKNOWN[210.245.34.254]
UNKNOWN[185.140.242.41]
I want to extract IP-addresses:
command shell:
cat drop.txt | cut -d'[‘ -f2 | cut -d’]’ -f1
- Get data from the file
- Delete all the text before the delimeter (we choose the text after the delimiter)
- Delete alle the text after the delimeter ( … before the delimeter)
The result:
123.21.181.4
122.174.155.161
118.137.18.160
118.69.71.76
177.71.93.43
210.245.34.254
185.140.242.41
Zabbix + reset password for the web interface Windows 10 + cannot install Intel Haxm + No VT detection
Comments are currently closed.