#3463

I accidentally made a 147GB file filled with grep output and almost filled up my hard drive. I’m switching the user name on my Mac, and wanted to try to replace all spots referencing the old location in the user’s folder. I thought I’d just grep them into a file that I could work my way through, like:

(find /Users/newuser -type f -exec grep '/Users/olduser' {} \+;) > results.txt

There are apparently a lot more references than I could’ve imagined. Or maybe it was a problem that the output file was in the user folder, with grep perhaps reading a file in such a way that it will read in changes as they’re added. It was taking a really long time to run. I assumed it was just the reading of the files causing a problem, but then I suddenly got a warning that I was running out of disk space and should clear unneeded files. I quickly killed the process and removed the file once I realized what happened. I’m not sure if all those references will cause a problem. Maybe I should figure out some sed magic and just replace them all in place, but I’m not sure if that will cause a problem either.