What is my Public IP Address?

August 22nd, 2007 mysurface

What is my public IP address? There is a lots of website can provide you the information. What if I wanna grep it for my script? We can use curl and grep for this purpose. First, lets pick few websites that provide the service to reveal my public IP. http://www.ipchicken.com/ – the chicken looks so […]

Posted in curl, egrep, grep, Misc, Text Manipulation, wget | Hits: 139642 | 20 Comments »

grep multiple keywords, AND not OR

June 21st, 2007 mysurface

This morning, I asked to analyze log files where I need to grep the lines with two keywords, and the post grep based on multiple keywords doesn’t help much. Refering to the post, where it grep the lines either keyword1 OR keyword2 appears. Where the case I intended to get is different, I need to […]

Posted in egrep, grep, Text Manipulation | Hits: 127336 | 21 Comments »

square brackets in regular expression

October 17th, 2006 mysurface

Previously we have an example on regular expression, but It doesn’t shows the power of square brackets ( [ ] ) Let say you want to search for string fprintf, vprintf and sprintf using grep, usually what you do is egrep “fprintf|vprintf|sprintf” *.c You may be ask why don’t just uses the word “printf”? If […]

Posted in egrep, Regular Expression, Text Manipulation | Hits: 89881 | 7 Comments »

Regular expression with egrep and ls

October 7th, 2006 mysurface

egrep is actually same as grep -E, it interpret PATTERN as an extended regular expression. Therefore ESCAPE ( \ ) is not needed for certain symbol. ls is a common tool for listing file that matches the keyword. Regular expression (RE) is a very important and useful to manipulating strings and text. In this example, […]

Posted in egrep, grep, ls, Regular Expression, Symbol, Text Manipulation | Hits: 96579 | 4 Comments »

grep based on multiple keywords

September 28th, 2006 mysurface

grep with multiple keywords need some knowledge of regular expression. But that is not difficult, use (OR). Let say you want to grep “me” and “you” at world.txt, you do grep “me\|you” world.txt You need to put ESCAPE STRING ( \ ) for OR ( | ), else it will treat it as a simbol […]

Posted in egrep, grep, Text Manipulation | Hits: 66581 | 7 Comments »