How long should replacing all white spaces with commas take in my 46MB text file using a simple text editor such as textmate on Mac?

link|improve this question

What exactly are you asking? Have you tried it yourself? If yes, do you think it's taking too long? – Siim K Apr 22 '11 at 7:40
Should be near instantaneous, if not instant... – studiohack Apr 22 '11 at 7:40
This is 46MB... I dunno about textmate, but a lot of text editors choke on files that large, textmate may not be working 100% properly. – jcrawfordor Apr 22 '11 at 7:50
@nimble @studiohack It is actually running since 20 minutes. That's why I'm asking. I just need some quick tip how this is usually done. Maybe some other text editor? – Patrick Apr 22 '11 at 8:02
feedback

1 Answer

up vote 3 down vote accepted

Using sed from Terminal this would take a few seconds:

sed -i "s/ /,/g" bigfile

(In my test, 565786 spaces in a 46 MB binary file were replaced in 2.1 seconds.)

Vim works too (:%s/ /,/g) but was a little slower.

Edit: s/[[:space:]]/,/g to include tabs (which, I assume, you meant by "whitespace")

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.