I want to delete 10 random lines from a text file that has 90 lines and then output this to a new file. I've been trying to do this using sed, but I have two problems. I'm using:
sed -i $((1 + RANDOM & 90))d input.txt > output.txt
and then running the command 10 times (I assume there is a better way to do this!)
The first problem I have is that I get the error:
sed: -e expression #1, char 2: invalid usage of line address 0
I assume this has something to do with the fact that it might have already deleted line 1 and it is trying again.
The second problem is that sometimes nothing is written to the output file, even though it worked before using the same command.