Length=$(cat Final.txt|wc -l)
echo $Length
sed -i '1 i\<records>$(echo $Length)</records>' Final.txt
I need to the add the line XXX where XXX should be the variable which represents the no.of lines.I have tried the above code and other combinations.None of them seems to work.