[Techtalk] real life kewl text-processing and regexps samples wanted

Brenda Bell k15a-list-linuxchix at theotherbell.com
Fri Jan 9 21:19:21 EST 2004


On Fri, 9 Jan 2004 16:03:05 -0800
Carla Schroder wrote:

> So let's have 'em, and don't be shy.

A command I use a lot is:

    cat dos-file.txt | sed -e '1,$s\^M\\g' >linux-file.txt

But that's because I'm always copying files edited on Windows to
my Linux box with the wrong format.  Note that the ^M is ctrl-M
which must be entered on the command line as ctrl-V ctrl-M.

I don't have any examples, but the cut command is one of my
favorites:

    cat test.txt | cut -d= -f1

Will print the first "field" of a file where fields are delimited
by = and "records" are delimited by new lines.

> 
> thanks!
> -- 
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> Carla Schroder
> www.tuxcomputing.com
> this message brought to you
> by Libranet 2.8 and Kmail
> ~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk

Brenda Bell
Henniker (the only one on earth)
New Hampshire (the state with 5 seasons: black fly, tourist, foliage, ski and mud)




More information about the Techtalk mailing list