0

Use case: I often have to deal with bad input data from my managers - malformed XML, CSV or other text files. I have to maually edit them into a usable format, which I normally do using a combination of Notepad++ and, in the more complex cases, Python.

What I'd like the most would be a Notepad++ plugin, which would allow me to manipulate the text in Python, taking care of the boilerplate surrounding it.
The plugin could, for example, load the text of the currently opened document into a file-like object ready for manipulation, and provide a second file-like object to write output to. The output would then be displayed in a different tab in NP++.

Is there any such tool? [How do I find it/what should I be looking for? I don't insist on using Notepad++ or Python.] Or should I approach the problem from some completely different angle?

Edit - clarification: I'm not looking for XML-, CSV- or any other format-specific tool or approach. I'm just asking about text processing in general. (Thanks to everone who tried, though.)

4
  • Not a plugin, but Augeas comes to mind.
    – EEAA
    Jun 6, 2012 at 13:47
  • There is nearly no tool suitable for parsing malformed XML. Python's CSV module might handle some malformed csv text if not horribly mangled. Failing that, tell (request) of your supervisor to give you better (or up to spec) data in order to get your job done effectively. Garbage in, garbage out. Jun 6, 2012 at 14:12
  • @ErikA I disagree. I've stated what problem I have and am asking for either where/how to find a tool, or what other approach to try. I'm not just asking for a recommendation, even though that would still be appreciated.
    – ver
    Jun 6, 2012 at 15:35
  • @PenguinCoder Tanks for the tips. I didn't want CSV- or XML-specific tools though, just text processing. And as for the second part - that was the first thing I tried, of course. Some people just don't get that giving you invalid testing data in invalid formats can, in fact, really slow you down. :)
    – ver
    Jun 6, 2012 at 15:36

2 Answers 2

0

XML and HTML lookalikes, depending on who you ask, sometimes don't fit into the definiton of text files, but for all other varieties (anything that isn't markup in < >) I've found Vim with my scripts always good enough to handle the task.

Apart from that, Perl and Python come naturally as solutions, depending on who you ask, and what camp he's from. I prefer Perl.

0

I found a solution - two plugins for Notepad++, Python Script and PyNPP. I wrote an example about it on my blog.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .