[CentOS] parsing /proc/cmdline

Fri Mar 7 16:46:37 UTC 2008
Ross S. W. Walker <rwalker at medallion.com>

Jerry Geis wrote:
> 
> Hi - I am not an expert at shell script writing.
> If /proc/cmdline looks like
> 
> option1 option2 ... ks=http://192.168.1.8/ks/ks.cfg option3 
> option 4 ...
> 
> How can I get the 192.168.1.8 out of this cmdline.

Try:

# IPADDR=`cat /proc/cmdline | sed 's/.*\/\([1-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\/.*/\1/'`

This will find an IP in between /.../

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3971 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20080307/7bb0cf50/attachment-0005.bin>