sed or awk question

Hello expert, I have an output file with few thousand lines similar like below : "Future Netmgmt" "10.99.16.0" "N" "10" "10.0.0.0" "Circuitless-IP" " " "255.255.254.0" "Future Netmgmt" "10.99.18.0" "N" "10" "10.0.0.0" "Circuitless-IP" " " "255.255.254.0" "WAAS loopbacks" "10.99.20.0" "N" "10" "10.0.0.0" "Circuitless-IP" " " "255.255.254.0" "Cisco WAAS" "10.101.249.0" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.128" "Cisco WAAS" "10.101.249.128" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.128" "" "10.101.250.0" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.252" "" "10.101.250.4" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.252" I try to get the second column of each line (i.e. 10.99.16.0). I try: awk '{print $2}' But it doesn't work correctly. Can you give me some tips how to do this. Thanks

Just to clarify - your text looks like this?

"Future Netmgmt" "10.99.16.0" "N" "10" "10.0.0.0" "Circuitless-IP" " " "255.255.254.0"
"Future Netmgmt" "10.99.18.0" "N" "10" "10.0.0.0" "Circuitless-IP" " " "255.255.254.0"
"WAAS loopbacks" "10.99.20.0" "N" "10" "10.0.0.0" "Circuitless-IP" " " "255.255.254.0"
"Cisco WAAS" "10.101.249.0" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.128"
"Cisco WAAS" "10.101.249.128" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.128"
"" "10.101.250.0" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.252"
"" "10.101.250.4" "Y" "10" "10.0.0.0" "NET-10-101" " " "255.255.255.252"

or this?

sed s/\"\ \"/\;/g filename| awk -F\; '{print $2}'

In this case, I'm looking for " " (assuming that this is your field deliminator), changing it to ;
Then, using awk to find the second field (deliminator of :wink: and display it.

I'd recommend looking at finding another way to store your variables - generally speaking ; is a good deliminator. This would reduce the code required to:

awk -F\; '{print $2}'

I understand that nawk will allow for more than one character deliminators (like :: or ;; ), but I haven't tried this

awk -F\" '{print $4}' file

I considered this, but I thought that the idea of every odd numbered field being empty might not go over that well...

Of course, my solution ends up with " preceding the first field (not stripped out) and " following the last field (not stripped out).
sed can resolve these, by substituing ^ and $ instances of "

Thank you everyone. The one "awk -F\" '{print $4}'" works best on my case.