Coding, is? Fun!

Thursday, October 27, 2005

GREP for windows

I found the open source Grep for Windows application from sourceforge.net URL:
http://gnuwin32.sourceforge.net/packages/grep.htm
The install does not add grep.exe to the path in windows; I had to do it myself.
The documentation has examples and all the usage options.

C:>grep --help shows all the options and their uses.
I tried some different grep statements:
1. Find Grant statements in a .NET database project
grep -E GRANT -r -h *.*
-h is to eliminate preceding filename
-E is for the pattern (extended regular expression)
-r is for recursive
I used -E because that was the first one I found, but -G can be used too.

2.Find one word with another word in the same line, irrespective of order
For example, to find the words "Emacs" and "gnu" in the same line.
grep -r -i -E Emacs *.* | grep -E gnu

This actually uses the "pipe" or "|" character to feed the output of one statement to another.

3. To find lines with (Emacs AND gnu) OR (Emac AND org)
grep -r -i -E "Emacs" *.* | grep -r -i -E "gnu|org"

The pipe "|" in this case is part of the regular expression and can only be used within the double quotes. If it is used without the double quotes, the command shell would interpret "org" as a command and not part of the regular expression.
4. Exclude a file
grep -r -i --exclude-pattern.txt -E "Emacs" *.* | grep -r -i -E "gnu|org"

excludes pattern.txt from the list of files to search.

5.Get more lines AFTER the matching line
grep -r -i -A 5 --exclude-pattern.txt -E "Emacs" *.* | grep -r -i -E "gnu|org"

The -A 5 gets 4 more lines AFTER the matching line.
The -B 5 gets 4 more lines BEFORE the matching line.

Sunday, October 23, 2005

I hate running in the same place

I started on my new adventures in wonderland two years back and I am still in the same place. ASP.NET 2.0 is coming out in a couple of weeks with SQL Server 2005. I know nothing about them. Macromedia Flash Professional 8.0 is coming out with regular expression support and apparently Macromedia Flex will have a new version. And I have not even started on Flex...I will wait till the next version... or the next.
If I stop running there are a couple of billion Indians, Chinese, Filipinos and Brazilians waiting to jump on me.
Here are a list of things I will try to write about in this blog.
1. ASP.NET
2. HTML, DHTML
3. Web Services
4. Code generation using CodeSmith for ASP.NET domain layers
5. Code generation using CodeSmith for Java domain layers
6. Flash programming
7. DTS
8. SQL Reporting Services
9. MDX
10. Analysis Services
11. Adobe Photoshop Image editing
12. Adobe Illustrator
13. Java Swing
14. Java Applets
15. Java Server Pages
16. EJB
17. Linux Basics
18. Microsoft Application Blocks
19. ADAM, Active Directory
20. Windows Installer
21. XML, XSL, Schemas and XPath
22. XHTML
23. XQuery
24. Model based development
25. Visio
26. Design Patterns
27. PHP, MySQL development

I know enough about some of these to write; I don't about some others and I will learn as I go.
This blog is meant more as a personal refresher and goal setter than an authoritative source - because I am not really an authority. If you want an authority, get those huge WinForms books by Petzold.
Let me see if I post atleast one ,more entry in this blog...