I have several configuration files, line starting with line has an IP address
My Read from the target line that starts with the line word from the file and prints the IP address only
The problem is that the IP address can be in any field in the line, so I According to the IP can not capture
example
grep LINE file1.txt LINE /home/Ariate/run.pl "Voda Stis 4 Test - "" 102841 "& amp; Amp; Ssh 17.77.170.130-P2022 grep LINE file2.txt LINE /home/Ariate/run.pl 137.77.170.30 "Voda STS 4 Test -" "102841" & amp; Amp; Expected Result
Resonance $ IP_Fom_Line 17.77.170.130 Echo $ IP_Form_Line 137.77.170.30
<
Using it grep -oE
:
< Code> grep -oE '\ d + \. \ D + \. \ D + \. \ D + 'file 17.77.170.130 137.77.170.30
or other:
grep -oP' \ d + \. \ D + \. \ D + \. \ D + 'file
Comments
Post a Comment