How would I go about appending a character to the end of every line except for the last line? The script won't know the length of the variable, as the last ten lines are loaded via tail.


In php we can use explode function, in that use "\n" as delimeter.
It will give you array of lines, traverse through each element and append the character you want to append except the last element of the array.
Now impload array using implode function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.