I am trying to achieve this by redirecting the output to the same file but my file goes blank overtime. Things I tried:
nl -s ') ' books > books
nl -s ') ' books >> books
in this case I am getting 2 copies of each line one numbered and the other non numberednl -s ') ' < books > books
cat books | nl -s ') ' > books
Rest other cases my input file is going blank. I do not wish to use a temporary file. How do I make changes to the same file while entering bash commands?