|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
cheatsheet for ed
On 2 different occasions, I've made a mistake on my system(s) and when rebooted, I was left with single user/root prompt and nothing to use but ed. I've read the man page for ed a few times, but just can't "get it". Is there a cheatsheet somewhere that I can print?
I tried googling, but couldn't get a hit on what I was really after. If/when I make another mistake like that, I want to be ready Thanks. |
|
|||
|
|
||||
As long as you can mount /usr you will be able to use /usr/bin/vi but you must export the term before start editing
Code:
mount /usr export TERM=vt220 http://www.openbsdsupport.com.ar/books/vi/ch05_01.htm |
|
||||
From a working system, you can also learn more about the functioning of ed, by reading the documentation
In /usr/share/doc/usd are files from the UNIX User's Supplementary Documentation (USD), including entries for ed, ex, vi, sed, and awk (sadly the usd for troff and macro packages are not installed, but you can get them online). Makefiles are present for building them in postscript / text format, most can also be manually processed with nroff and fed into ed or a pager. take a look at 09.edtut, and 10.edadv after that, you should be able to use ed effectively -- it is actually a very good tool, especially if a network connection is light, and a more modern line editor is not available. (e.g. vim followed by gQ command, or sam).
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. Last edited by TerryP; 16th May 2009 at 08:38 PM. Reason: Typo fixed, thx unicyclist |
|
|||
Thanks for all the help. Something new for me in each comment
Terry, fwiw, usd is under /usr/share/doc in OpenBSD. I had to run locate to find it |
|
||||
Oops, typo -- corrected, thanks!
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
Terry, I had another reason to use ed:
I reformatted a partition that was listed in my fstab file so when I rebooted OpenBSD... Using ed, I was able to change the affected line (changed from dos to ext2). I'm really getting to like the simplicity of ed, and getting quite fond of it. Even using it when I'd normally us vi. Thanks again to all of you for help/url's |
|
||||
If using ed regularly, you might also like to look into one that has a command history, like GNU ed. Its a bit more readline esque than BSDs version.
You might also like to try Rob Pikes 'sam' editor.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
You might also like ex(1), which is a line-editor like ed, but compatible with vi.
|
|
|||
The Unix Programming Environment, Kernighan and Pike. Not a cheat sheet of course, but a book worth having, and not hard to find what you need to know about ed in it. Usually when I need ed, I don't have /usr mounted anyway, so having something on paper describing it is good. If you're going to get this book anyway, having it will save you printing ed(1).
|
|
|||
thirdm, I'll have to watch for that book. Not working right now, though, so already printed the files under /usr/share/doc/usd
BSDfan666, I've looked at ex and have been reading the link that Oko gave. Thanks Don't recall reading about "sam". Will have to at least read about it, but right now I'm happy knowing that I can use ed to fix text problems. Don't want to overwhelm the grey matter more than it already is Thanks again everybody |
|
||||
Quote:
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|