What is the fastest / most efficient * nix search / replace app

I have a large SQL dump of 250 MB +, and I need to replace www.mysite with dev.mysite. I tried nano and vi for search / replace, but both chokes. Nano cannot even open it, and vi has been searching / replacing for an hour now.

Does anyone know a tool on * nix or windows systems that quickly find / replace large files?

+3
source share
3 answers
sed -i 's/www\.mysite/dev.mysite/g' dump.sql

(requires temporary storage space equal to input size)

+5
source

Finding / replacing on a SQL dump is not a good idea

  • These are not text files.
  • SQL syntax errors are easily entered
  • Sometimes they contain very long lines.

, , UPDATE, . REPLACE MySQL .

+4

you need sed

Example

sed -e "s/www.mysite/dev.mysite/g" your_large_sql

alternatively import sql into the database, then use replaceto replace for matched rows

+1
source

Source: https://habr.com/ru/post/1789408/


All Articles