Delete line from file at specified line number in bourne shell
sed, shell, unix
Solution
To delete line 5, do:
sed -i '5d' file.txt
For a variable line number:
sed -i "${line}d" file.txt
If the `-i` option isn't available in your flavor of sed, you can emulate it with a temp file:
sed "${line}d" file.txt > file.tmp && mv file.tmp file.txt
Problem
I'm making an appointment tracking script in Bourne Shell and need to delete an appointment from the text file. How do I delete a line from a file leaving no white space if I have the line number? The file looks like this: ``` 1:19:2013:Saturday:16.00:20.30:Poker 1:24:2013:Thursday:11.00:11.45:Project meeting 1:24:2013:Thursday:14.00:15.10:CSS Meeting ```