[CALUG] regular expressions

Rick Radzville rradzville at hotmail.com
Tue Nov 22 08:05:37 CST 2005


ROTFLMAO! I was going to ask Jim about the "regexp" part of his original 
comment, then had the common sense to use Google, find that it meant 
"regular expression", remembered that the "re" in grep stands for "regular 
expression", and thought "This sounds like something I need to know". :>) So 
thanks for reading my mind. I also wanted to apologize for hijacking the 
"Best programming app" thread, and I hope it's OK that I changed the subject 
line to what we're actually talking about.

Thx,
Rick

>From: Josiah Ritchie <josiah.ritchie at gmail.com>
>To: Rick Radzville <rradzville at hotmail.com>
>CC: lug at calug.com
>Subject: Re: [CALUG] Best programming app
>Date: Tue, 22 Nov 2005 08:55:55 -0500
>
>Learn Regular Expressions (regex) as that multiplies the usefulness of
>any good text tool. An online book here has some good material
>http://rute.2038bug.com/index.html.gz . You can buy Rute's Guide in
>paper also.
>
>sort, diff, grep, awk, wc are a good place to start.
>
>Linux Journal just started a shell scripting. First article is in the
>MythTV edition and it introducing pipes which is also priceless.
>That's the | > < << >> symbols you see in commands.
>
>All priceless functions that make the power of the linux cli over the
>"dos prompt" really shine
>
>I had a user with two copies of a large spreadsheet that he couldn't
>remember what he'd changed in one and they forgot and changed things
>in the other copy. So in the way of a real world example . . .
>
>I exported them both to csv, sorted them to be sure they were in the
>same order and used diff to determine where the changes were. Then I
>cleaned up the diff output a bit to make it more intelligible to
>someone who doesn't know diff, meaning I grep'd the lines again to
>remove lines not starting in < or > and then sorted the lines so the >
>lines rose to the top.
>
>It probably looked something like this (I don't have Linux available
>atm so can't check it):
>sort first.csv > one.csv
>sort second.csv > two.csv
>diff one.csv two.csv | grep -e (^>|^<) | sort > differences.text
>
>The (^<|^>) part is a regexp, indicated by the -e before it. It tells
>grep to find any lines that start with either < or >. The ^ indicates
>the beginning of the line. The () bring together a collection of
>things and the | indicates the break between elements.
>
>grep's input comes in through the | before it and goes out to sort
>through the | after it. The > pops the end results of sort into a file
>called differences.text.
>
>Some folks more handy than I could probably make this one line instead
>of three. Anyone want to mess with that?. I always enjoy a good
>disection of my commands. :-)
>
>JSR/
>
>On 11/21/05, Rick Radzville <rradzville at hotmail.com> wrote:
> > Wow. I'm an expert microsoftie, linux newbie. This comment is the reason 
>why
> > I'm experimenting w/Linux. Jim, would you mind sharing a few more 
>details?
> > When you refer to "data", are you talking about "a listing of the
> > directories & files on the user's PC" or "a database"?
> > v/r,
> > Rick Radzville
> >
> >
> > >From: Jim Sansing <jjsansing at comcast.net>
> > >To: lug at calug.com
> > >Subject: Re: [CALUG] Best programming app
> > >Date: Sat, 19 Nov 2005 12:43:17 -0500
> > >
> > >I don't know about supercharged, but powerful definitely.  I just
> > >love showing off in front of the microsofties at work, by pulling
> > >their data over to Linux, getting a listing of files and then using vi
> > >regexp's and commands to modify it, and giving them back.  All
> > >of this takes a couple of minutes in vi, where it would take an
> > >hour or more with the best M$ has to offer (whatever that
> > >might be).
> > >
> > >And it seems like I learn a new feature each month.  So as powerful
> > >as I have found it to be, I feel like I am using less than half of what
> > >it is capable of doing.  So come to think of it, it's really not a 
>stretch
> > >to say that by taking full advantage of the PC101 keyboard (vim) and
> > >the mouse (gvim) is supercharging the already powerful vi.
> > >
> > >Later . . .   Jim
> > >
> > >
> > >Bryan Breen wrote:
> > > >Dave Dodge wrote:
> > > >
> > > >>There are plenty of career programmers who work in vi, or one of
> > > >>its supercharged variants such as vim.
> > > >>
> > > >
> > > >ROFLMAO! "supercharged"... I do all my web page development and
> > > >programming in vim, and that is the last adjective I would have ever
> > > >though of to describe it. I'll have a smile on my face for the rest 
>of
> > > >the day now. :)
> > > >_______________________________________________
> > > >Columbia, Maryland Linux User's Group (CALUG) mailing list
> > > >CALUG Website: http://www.calug.com
> > > >Email postings to: lug at calug.com
> > > >Change your list subscription options:
> > >http://calug.com/mailman/listinfo/lug
> > > >
> > > >
> > >_______________________________________________
> > >Columbia, Maryland Linux User's Group (CALUG) mailing list
> > >CALUG Website: http://www.calug.com
> > >Email postings to: lug at calug.com
> > >Change your list subscription options:
> > >http://calug.com/mailman/listinfo/lug
> >
> >
> > _______________________________________________
> > Columbia, Maryland Linux User's Group (CALUG) mailing list
> > CALUG Website: http://www.calug.com
> > Email postings to: lug at calug.com
> > Change your list subscription options: 
>http://calug.com/mailman/listinfo/lug
> >




More information about the lug mailing list