2

How do I import a CSV file into postgres and make it skip the first 3 line and last line

Is it possible in postgres if yes how ?

1 Answers1

0

Nope, can't be done. Please file an issue with them.

If you're on *Nix, then you can use tail | head:

tail -n+4 file | head -n-1 > newfile

If Windows then combine Batch file to delete first 3 lines of a text file and Deleting last n lines from file using batch file then realize the errors of your ways and use unix

Community
  • 1
  • 1
Neil McGuigan
  • 46,580
  • 12
  • 123
  • 152
  • @Shubhambatra You can easily get all unix command line tools for windows: http://gnuwin32.sourceforge.net/packages/coreutils.htm And you don't need to create a new file. The `copy` command accepts a program as it source: Check the `PROGRAM` parameter: http://www.postgresql.org/docs/current/static/sql-copy.html –  May 16 '15 at 20:50