On (08/08/07 15:18), Sebastien Roy wrote:
> 
> LINK="ip.tun0" TYPE="ipv4"
> LINK="tun0" TYPE="ipv4" SOURCE="10.8.57.44" DESTINATION="10.8.48.177"
> 
> I want to set a variable to contain the list of tunnel link names, so I 
> start with:
> 
> dladm show-iptun -p | cut -d ' ' -f 1 | cut -d '=' -f 2
> 
> This gives me:
> 
> "ip.tun0"
> "tun0"
> 
> Any simple way to strip the quotes?  One way is:
> 
> bash-3.00# dladm show-iptun -p | cut -d ' ' -f 1 | cut -d '=' -f 2 | cut 
> -d '"' -f 2
> ip.tun0
> tun0
> 
> This works, but I feel like I'm abusing the cut command. :-}  I'm sure 
> someone can come up with a more clever method.  Any takers?

Not sure if this is more clever, but how about 

dladm show-iptun -p |awk -F\" '{print $2}'

> It might be nice to incorporate some command-line syntax into dladm to do 
> this type of output filtering, but given the way that dladm does output 
> currently, this wouldn't be obvious to implement.

I think it's simpler (and easier to understand) to just pipe the 
output to your favorite filter...

--Sowmini



Reply via email to