I am facing an issue that I have File that every time have different row count and it ends with sqlldr output that shows amount of rows exported to file
40968 rows selected.
Since this file will be picked up by next process I want to get rid of this additional text. So I came up with idea like this:
# Remove exported record count from end of file
remove_count=$(( $(wc -l < ${output_dir}/file.dat)-3+1 ))
echo "Removing extra lines from spooled file"
sed '$remove_count, $ d' file.dat >> file.dat
The problem is that it seems that sed
cannot use variable as amount of lines after which it should start deleting. I could not find better solution.
Is there something I can do better or anyone sees mistake?
Thanks in advance!