Is there a command that will allow me to edit the last n lines in a file? I have several files, that all have a different number of lines inside. But I would like to modify the last n lines in each file. The goal is to replace commas with semicolons in the last n lines. But only in the very last n lines.
I do not want to delete any lines, I just want to replace every comma with a semicolon in the last n lines in each file.
Using the sed command I am able to replace the very last line with this command. As described here: How can I remove text on the last line of a file?
But this only enables me to modify the very last line, and not the last n number of lines.
sed '24,$s/,/:/g' filename
where24
is the starting line`