Sample Header Ad - 728x90

Replace string in file without temp file

0 votes
1 answer
161 views
I have a multi-gigabyte text file and I want to replace all occurrences of utf8mb4_0900_ai_ci in it with utf8mb4_unicode_520_ci. Usually, I’d use sed -i for this as suggested here: https://unix.stackexchange.com/questions/272052/find-and-replace-a-string-in-a-file-without-using-temp-file-with-sed However, this creates a temp file under the hood and I need this replacement to occur in an environment that won’t have the disk space to support that. How can I modify the file in-place?
Asked by ScottishTapWater (187 rep)
Oct 2, 2024, 01:36 AM
Last activity: Oct 2, 2024, 12:48 PM