So I came across this interesting question on SuperUser yesterday, and it got me thinking… would it be possible to create a full text editor using only standard terminal commands? That is, could we create a text editor using only standard tools such as shell scripts, sed, awk, grep, etc. That way it could be completely portable, and not depend on any binaries on the target system. The only binaries which would be required would be for the standard tools – which should already be installed.
Anyway, that would be cool.
$ whatis ed
red (1) – line-oriented text editor
ed (1) – line-oriented text editor
$ whatis sed
sed (1) – stream editor for filtering and transforming text
Assuming you have at least sed, you can do anything you need. Looking at the SuperUser question, that system was very very limited, and the best option was to move the file to another system, edit, and move it back. (You can use ssh to cat a file out, and cat a file in very easily)
Most people know how to use sed to perform a regex. It can do much much more, so you should learn it.
True, sed/ed would work. I was thinking more along the lines of vi though, as only editing a file in terms of lines could get very tedious.