Timeline for Is there a faster way to remove a line (given a line number) from a file?
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 22, 2021 at 20:48 | comment | added | Ryan | Actually, since my file is only 1.4 G, I then tried your first approach, and that worked. +1. Thanks! | |
| Apr 22, 2021 at 20:37 | comment | added | Ryan | I was optimistic to see this answer but ran into the same problem as unix.stackexchange.com/questions/66730/… | |
| Oct 10, 2019 at 9:34 | comment | added | alexis | Good point, ex is a more robust line-oriented editor, and it accepts a superset of ed commands (in particular, it understands 10,31d and wq as given above). | |
| Mar 10, 2015 at 12:20 | comment | added | Nemo | However, I think ex (elvis 2.2.0) is better for large files: CPU-bound, few KB of memory used. ed (1.6) run out of memory (over 2 GB memory used) over my 9 GB file. Which explains why you said to use sed or perl for files of unlimited size. ;-) | |
| Mar 10, 2015 at 6:48 | comment | added | Nemo | Nice trick! It's also possible to count lines from the end, for instance (echo '$-4,$d'; echo wq ) | ed input.txt deletes the last 5 lines. See also the line addressing section of the manual. | |
| Mar 4, 2013 at 18:39 | history | edited | alexis | CC BY-SA 3.0 | added 30 characters in body |
| Mar 4, 2013 at 18:23 | history | edited | alexis | CC BY-SA 3.0 | edited body |
| Mar 4, 2013 at 18:14 | history | edited | alexis | CC BY-SA 3.0 | added 369 characters in body |
| Mar 4, 2013 at 18:09 | history | edited | alexis | CC BY-SA 3.0 | added 369 characters in body |
| Mar 4, 2013 at 17:58 | history | answered | alexis | CC BY-SA 3.0 |