Read first x lines of csv file into new outfile?

后端 未结 2 843
走了就别回头了
走了就别回头了 2021-02-05 01:18

How would one copy only the first x lines of a csv file into a new csv file via the terminal?

2条回答
  •  温柔的废话
    2021-02-05 02:01

    This might not work for you if your CSV contains "lines" containing newline seperators, e.g. in Quotes. A short PHP Script that would solve this issue, so you would get 1500 "lines"/"datasets", each possibly containing multiple "file lines"

    To execute:

    php -f scriptname.php input.csv output.csv 1500
    

提交回复
热议问题