I need to insert string to text file, for example, before first line from the end.
STRINGS=`wc -l $OLDFILE \
| awk '{print $1-1}' \
| sed "s/$DOLLAR/+/g" \
| tr -d \\\n \
| sed "s/+$DOLLAR//" \
| bc`
ADDFILE=$3
head -n $STRINGS $OLDFILE > $NEWFILE
cat $ADDFILE >> $NEWFILE
tail -n 1 $OLDFILE >> $NEWFILE
Can you suggest simple way to perform that? Thanks