csh use of grep | tr commands

Christoph Kukulies kuku at kukulies.org
Mon Aug 10 12:14:42 UTC 2020


file t:

ip4="1.2.3.4"


sed 's/\(ip4="\)\([^"]*\)\(".*$\)/\2/' <t


OTOH, tr -d '"‘ strips off double quotes.


Christoph



> Am 10.08.2020 um 02:34 schrieb Ernie Luzar <luzar722 at gmail.com>:
> 
> Double quotes are giving me trouble.
> 
> I have a file with a line in it like this
> ip4="10.111.098.2"
> I want to get just the ip address
> 
> ip=`grep "ip4=" directory-path/file-name
> 
> $ip ends up having ip4="10.111.098.2"  in it
> 
> ip=`echo -n "${ip}" | tr -d "ip4="
> 
> $ip ends up having "10.111.098.2"  in it
> 
> Putting | tr """ " "` after the echo above gives error.
> 
> How do I remove the " around the ip address?
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3363 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20200810/fb458c35/attachment.bin>


More information about the freebsd-questions mailing list