Ingredients:
Windows XP Pro
GNU sed version 3.02
A 21MB text file with whitespace.
Method:
A simple
sed "s/ //g" InpFile.txt > OutFile.txt
Result:
My assumption was it would go through the file line by line, strip out the whitespace, and write it to output. However, memory usage steadily increased to 1GB, whereupon XP said 'No more memory for you!' and the process died with 'Can't write to nonexistant pipe'.
Variations like
type InpFile.txt | sed "s/ //g" > OutFile.txt
did the same thing.I'm too much of a wuss to try this on our Unix box, lest it does the same thing, causing the admins to storm out of a smoking server room wielding a sharpened cluex4.
Question:
Is this normal/expected behaviour for sed?
Side note:
In the end I used tr, like I should have done all along. Took just a few seconds.