Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to sort a large csv file but the output is not being written to another file

Tags:

bash

sorting

I have a (very) large csv file almost around 70GB which I am trying to sort using the sort command. As much as I am trying, the output is not being written to file. Here is what I tried

sort -T /data/data/.tmp -t "," -k 38 /data/data/raw/KKR.csv > /data/data/raw/KKR_38.csv
sort -T /data/data/.tmp -t "," -k 38 /data/data/raw/KKR.csv -o /data/data/raw/KKR-38.csv

What happens is that the KKR_38.csv file is created and its size is the same as the KKR.csv file but there is nothing inside it. When I do

head -n 100 /data/data/raw/KKR_38.csv

It prints out 100 empty lines.

like image 993
thisisshantzz Avatar asked Nov 30 '25 16:11

thisisshantzz


1 Answers

If you sort, it is quite normal the empty lines come first. Try this:

tail -100 /data/data/raw/KKR_38.csv
like image 93
Gerard H. Pille Avatar answered Dec 02 '25 05:12

Gerard H. Pille