bash - Putting a string on same line tcl -


i have nmap output , need put strings on different lines on same line.

nmap output:

 nmap scan report 169.254.0.1  host (0.014s latency).  not shown: 97 closed ports  port     state service  80/tcp   open  http  1720/tcp open  h.323/q.931  5060/tcp open  sip  device type: voip adapter|wap|pbx|webcam|printer 

new ouput:

169.254.0.1,voip adapter

how can on tcl or bash?

in tcl, can use regexp extract required data.

set nmap_output "nmap scan report 169.254.0.1  host (0.014s latency).  not shown: 97 closed ports  port     state service  80/tcp   open  http  1720/tcp open  h.323/q.931  5060/tcp open  sip  device type: voip adapter|wap|pbx|webcam|printer"  if {[regexp {scan\s+report\s+for\s+(\s+).*device\s+type:\s+([^|]+)} $nmap_output match ip type]} {     puts $ip,$type } 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -