I would suggest doing this in an `ex`-compatible way. That is, the command line argument +n causes the current line to be n, and the command line argument +/pattern causes the current line to be the first line matching the pattern. Given the file foo.txt containing five lines "one", "two", "three", "four", "five", then "ed +2 foo.txt" will sest the current line to 2 and "ed +/thr foo.txt" will set the current line to 3. Patterns are regular expressions.
On Sun, Feb 19, 2023 at 4:28 AM Matthew Polk <tracekeep...@gmail.com> wrote: > I like ed. I think it's a cool editor. One thing that in my opinion to > make it more usable with other programs would be to have implemented, > is a command line option to have ed automatically start at the > specified line rather than at the very bottom. I like to (for example) > use less to view text files as a pager and would like to use ed to > edit a line, but setting ed as my $EDITOR causes it to always open at > the very bottom of the file. So I decided to do something about it, by > contributing to ed for the next release. I'm willing to spend a few > days to write up a patch because ed is a rather small program and get > it reviewed for changes. I first would like suggestions on how to > tackle this. If anyone wishes to offer help, it would be appreciated. > Ed already has a few extensions not found on BSD (Such as OpenBSD ed) > or especially historical ed, so it wouldn't at all feel out of place > to have a feature found in vi or emacs. > >