Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|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
add comment

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")

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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