Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .