in reply to replace fist and last occurrences of N
Well, if you've got enough memory you could read the entire file into memory and use a regex. Alternatively, you could read the file a character at a time (read the documentation for $/), and change the current character if it's /n/i and the previous one wasn't, or the previous character if it's /n/i and the current one isn't. I've got to run some errands, so I'll try to post some code later.
|
|---|