in reply to file not being split at new lines

Was the JS file last edited on the same machine you're writing a script to edit it on? You might have a different line-ending. Windows uses \n\r, Unix uses \n, and Mac uses \r. You might have to set $\ to the right value for it to automatically split the incoming data.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^2: file not being split at new lines
by ysth (Canon) on Mar 17, 2005 at 08:39 UTC
    \r\n, not \n\r, and only classic Macs use \r IIRC.