Is there a command line or a tool in Ubuntu to "Find & Replace" a word in a 80mb file that accours about 150000 times?
I want to replace http://www.old-domain.com/subfolderA
with http://www.new-domain.com/subfolderB
I tried it with gEdit and Atom but both crashed.
Best Answer
sed
can do:This edits the file directly leaving a backup named
very_big_file.bak
. It scans your file for lines containingoldword
and replaces every occurence withnewword
, which should be much faster than runnings/oldword/newword/g
over every line (see Replace text quickly in very large file). Quoting sed1line:If
oldword
and/ornewword
contain slashes you can either escape them with backslash (e.g.http:\/\/www
) or use a different delimiter, e.g. underscore:In your exact case I would do: