On Monday 20 Apr 2009 09:28:49 Arun Khan wrote:
On Monday 20 Apr 2009, Mukund Deshmukh wrote:
/sbin/ifconfig eth0 | egrep "RX bytes" | sed -e 's/[ ]{2, }//g' -e 's/([0-9]{1,}.[0-9]{1,} [KM]b)//g' >> <filename>
I feel people who can write regular expression are the most brilliant people on this earth :-))
Actually, It could take more effort to read and decipher a complex regex written by someone else :P
The above is quite simple,
Well, I figure that its all the extra \ that BRE makes you put in makes it look `impressive' to newbies ;) For instance, with ERE, one could use just + instead of {1,}. GNU's sed allows ERE with -r btw. Not portable, of course.
some of the stuff that I seen from PERL geeks boggles my mind
Hehehe, like a `proper' regex for matching email addresses :P http://www.regular-expressions.info/email.html
but testing our regular expressions before putting it into action/production is a must :D
Agreed.
Mrugesh