2

I have a CSV file that has 5 lines at the top of the file that I want to remove using node.js. I then want to add my own header line that better matches the header I would use. I have no control of the original csv file so unable to to do this at the source.

1 Answer 1

1

It will be easiest using one of the following modules:

or other that you find in:

(don't worry if it's CSV or TSV - just make sure that you use the correct delimiter which is comma in your case).

You might do it all manually parsing the file as text but using a module for that will be much less error prone.

(cat good-header.csv; tail -n +5 original-file.csv) > the-result.csv
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.