Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Specific Text in Bash Output

I want to get the ip only from this output but idk how.Is it possible to limit the output to only what i want.

VPN Connection Setting Name                          |kap1
Destination VPN Server Host Name                     |159.89.199.192
Destination VPN Server Port Number                   |5252
Destination VPN Server Virtual Hub Name              |kap
Proxy Server Type                                    |Direct TCP/IP 

Another problem. The ip have port. I only want the ip. Sorry for another question. I appreciate your help you all.

VPN Connection Setting Name |kap1
Status                      |Connected
VPN Server Hostname         |159.89.199.192:5252 (Direct TCP/IP Connection)
like image 236
1995 Avatar asked Feb 23 '26 01:02

1995


1 Answers

Considering the data you have shared is saved in a file. File name : file.txt

$grep 'VPN Server Host Name' file.txt | awk -F '|' '{print $2}'
159.89.199.192
like image 144
sonali srivastava Avatar answered Feb 25 '26 17:02

sonali srivastava