#!/bin/bash
file="/home/library/Desktop/temp" #get file path
#echo $file
number=$(sed -n '$=' $file) #get the whole file line number
#number2=$[$number-2]
#$echo $number
#$echo $number2
sed "$[$number-2] s/$//n/" $file # insert a newline afte reciprocal 2 line (2 line from bottom )
如果想从正数可以用;
sed "2 s/$//n/" $file
j就是正数第二行