Ross S. W. Walker wrote: > 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 /.../ Actually shorter sed line: # IPADDR=`cat /proc/cmdline | sed 's/.*\/\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\/.*/\1/'` When testing the '+' operator initially, it didn't work for me, then it occurred to me to escape it from the shell. I didn't realize bash used '+', need to look that one up. Also this regex isn't so picky about ip address validity, but since it's in kickstart chances are it's a valid ip. -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/afb665cd/attachment-0005.bin>