0

I have a CSV file which is around 3 GB having 20 million lines. I am trying to replace a string in a line using sed but it takes around 12 minutes on my i5 processor with 4GB RAM. This is the command I am using right now.

sed -i '27s/string1/string2/' hugetext.csv

Is there a faster way to do it?

Amir
  • 1
  • 2
    There's only a faster way if the line you're replacing is the same length with the line you're replacing it with and you know exactly where the line is. If it's not consider using a database instead of a text document. – apokryfos Mar 31 '18 at 14:30
  • If both of the lines have same length, what is the faster way? – Amir Mar 31 '18 at 14:35
  • Open the file and replace bytes X to Y with the new content. May need some script to do this. – apokryfos Mar 31 '18 at 14:43

0 Answers0