Grep and Awk equivalent in VB.NET?

jlwilson

Member
Joined
Jun 23, 2005
Messages
11
Location
Harrison, AR
Programming Experience
Beginner
Is there a Grep and Awk equivalent in VB.NET?

For instance, in Linux If I had the following data in a file and I wanted to only see the SERVICE_NAME line, I could type the following command:

cat filename.txt |grep SERVICE_NAME
output would be: "SERVICE_NAME: WZCSVC"

If I wanted to get just the name of the service, I could type:

cat filename.txt |grep SERVICE_NAME |gawk '{print $2}'
output would be: "WZCSVC"


============== Example Data in filename.txt ====================
SERVICE_NAME: WZCSVC
DISPLAY_NAME: Wireless Configuration
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 4 RUNNING
(STOPPABLE,NOT_PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
========================================================


Can someone help me please? I keep looking up text parsing information and stuff on the NET but I can't seem to find anything that makes sense to me.

Thick headed VB.NET newbie, signing off . . . . .
 
There is a System.Text.RegularExpressions namespace and the most commonly used class is Regex. That's where you want to look. There are quite a few topics on MSDN regarding regular expressions.
 
Back
Top