Parsing text files
Posted
by
d03boy
on Super User
See other posts from Super User
or by d03boy
Published on 2009-08-22T04:34:38Z
Indexed on
2011/03/10
0:12 UTC
Read the original article
Hit count: 353
I encountered a situation tonight where I wanted to parse a text file. I had a very, very long word list that contained English words delimited by lines. I wanted to get rid of every word (or line) that was longer than 7 characters. This would be simple in Linux but I can't seem to find a simple solution in WindowsXP. I tried using Notepad++ regular expression search but that was a huge failure. I tried using the expression .{6,}
without finding any matches. I'm really at a loss because I thought this sort of thing would be extremely easy and there would be tons of tools to accomplish a task like this. It seems like Notepad++ supports every other feature in the world except the very basic ones that seem the most obvious.
Another one of my goals was to put some code before and after the word on each line.
aardvark
apple
azolio
would turn into
INSERT INTO Words (word) VALUES ('aardvark');
INSERT INTO Words (word) VALUES ('apple');
INSERT INTO Words (word) VALUES ('azolio');
What suggestions/tools/tips do you have to accomplish tasks similar to this in WindowsXP?
© Super User or respective owner