View Single Post
Old 11-06-2006, 01:36 PM   #9
kacir
Wizard
kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.
 
kacir's Avatar
 
Posts: 3,463
Karma: 10684861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
*nix tools for processing text

Quote:
Originally Posted by valkyriesound
I'm new... what's *nix and std text pattern tools? Links?
like sed, awk, emacs, vim, vi, grep, and countless others
There are versions for Windows for each of those tools. My favourite tool is vim
www.vim.org
Vim is extremely powerfull text editor. It uses regular expressions. Regular expressions are what all those text processing *nix tools have in common.
Regular expressions are a kind of language used to describe "patterns" in text
See http://en.wikipedia.org/wiki/Regular_expressions
Vim has a steep learning curve, but it is the most powerfull tool in the hands of an expert.
If you want to try regular expressions, and you do not wish to learn the basics of vim try windows editor TextPad www.textpad.com

Quote:
Originally Posted by valkyriesound
Yeah... anyone know a quick way to get rid of those extra blank spaces it adds?
It is very simple.
Open file in vim
press Esc
type
:%substitute/ */ /g
or in short
:%s/ */ /g
^ that is :%s slash space space starr slash space slash g
: means - this is an "ed" command. Ed is an anicent Unix editor. Its stream oriented version sed is one of the most used text parsing tools ever.
% means apply the following command (substitute in this example) on all lines not just on the current line. % is an address. There are many kinds of addresses you can use for a command. This is one of the features that makes vim *SO* powerfull.
g means - do not replace just the first occurence of pattern but all occurences on the line


In textpad
from menu start "find and replace" dialog
search pattern
*
^ that is space space star
replace pattern

^ that is one space
and check "use regular expressions" check box


if you want to learn vim, just install it, start it and type
Esc
:help

Vim has the best documentation I have *ever* seen in a program.
kacir is offline   Reply With Quote