How to? I've got a script parsing through a tab-delimited text file and converting it to a format as specified by an investment securities company. The script tacks a "\n" to each line to (Who'da guessed?) start a new line. How can I remove the last newline? There will be a variable number of lines in this file so I can't just use a count control for it. I figure it would be easiest to delete the last line as a final, quick little command.
So yeah, how to? Thanks.
sorry, i lost clarity toward the end, do you want to remove the entire last line i.e. data data data\n or the last newline '\n' ?
I wanna turn
data data data data data data
into
. So I want to remove the last "\n".
Sorry for the lack of clarity.
Is the newline character always going to be there? $line=substr($line,0,-1);