Friday, May 24, 2013

eth0 not showing in CENTOS VM



  1. Check whether the eth0 is available
                /sbin/ifconfig -a

            Please execute the aove script, if your result showing eth0 then please proceed to 2.
    
      2.    dhclient -v eth0
   
       This forces the interface to get an IP via DHCP

Then please check whether you can ping to outside world.


Also please check the below file.

/etc/sysconfig/network-scripts/ifcfg-eth0 and set

 ONBOOT=yes
 BOOTPROTO=dhcp

Sunday, April 7, 2013

Extracting Numerical values from a string

1)  Cutting numerals from a string
        sed 's/[^0-9]*//g'
  
    For example:
                           Hello world my name is 1234abcd
        Output      : 1234



2)  Extracting First number from a string
        sed 's/[^0-9.]*\([0-9.]*\).*/\1/'
  
     For example: Hello 123 world, my name is 1234abcd
            output    : 123