tac
is neither standard nor necessary. When you want to edit a file, use a file editor like ed
, rather than its derivative sed
(which is used to edit streams).
for i in RMSF_CA_proA_*; do
printf '%s\n' '$' '-161,$d' 'w' | ed -s "$i" > /dev/null
done
ed
reads its commands from standard input, one command per line.
The $
command makes the last line of the file the current line. The -161,$d
deletes the desired lines, with the range extending from the 161st line before the current line up to and including the current line. w
saves the changes before exiting.