Insertion in a file

Hi All,

I want to insert a line just befor the lst line in a file. please can anyone advise.

Cheers,
Shazin

Something like this or without writing a second file that you could mv to the 1st file?

$> cat infile
eins zwei
drei vier
fuenf sechs
$> sed '1 i\some line' infile >> outfile
$> cat outfile
some line
eins zwei
drei vier
fuenf sechs

Hi

Please can you advise if i want to insert into the last but second line.

Cheers,
Shazin

$> sed '$ i\>>second last line' infile
eins zwei
drei vier
fuenf sechs
sieben acht
neun zehn
>>second last line
last line