To put it into context - I needed to read and parse the contents of a log file. Sometimes log entries would contain carriage returns/ linefeeds and other whitespace characters like tabs that would cause issues with the simple formatting functions I had created.<br />
<br />
I decided to use the parameter expansion/ substitution function ${parameter/pattern/string} to search for patterns and replace with strings, in this case carriage returns/ tabs and replace with a single whitespace character. However I detected horrendous delays in in some instances, from 10 seconds to 30 minutes, for a single substitution to occur for strings that were only 500 characters long
↧