in reply to Re: Auto correct a csv file
in thread Auto correct a csv file

This works perfectly. But it deletes the very first line. How to prevent this?

Replies are listed 'Best First'.
Re^3: Auto correct a csv file
by graff (Chancellor) on Feb 26, 2014 at 00:31 UTC
    … But it deletes the very first line. How to prevent this?

    Can you post an example data file to demonstrate this problem? (For example, just copy the first few lines from the "real" data file in question and put them in a separate file. Then run the command line to produce a modified version of that. If the first line of input is missing from the output, please post the input, the command line you actually used, and the output.

    I suspect that one (or more) of the following could be happening:

    • You aren't using the exact code that I posted.
    • What you think should be "the first line" of your input file is not actually in that file to begin with (that is, it was missing before you ran the script).
    • There's something goofy going on with carriage-return characters in your data, and the first line really is there, but you might not be "seeing" it because maybe it ends with just CR instead of CRLF, which might cause the 2nd line to be printed "on top of" the first one in your display.

    I have no way to answer your question without knowing more about your data.