ed
, right? Sure you do, because ed
is the standard Unix editor! Last night I was working on a computer that didn't have ed
installed, so I quickly wrote a bash implementation. It's not that hard after all! Check it out:
gniourf@somewhere:~$ while ((1)); do read; echo '?'; done
All right, apart from saying stupid things in this note, I'd just like to say that ed
can be really cool to format files from a bash script. Most people use sed
quite fluently, and are always tempted to solve some problems with it in scripts. ed
can be useful because it's file
to hello, gniourf_gniourf
you'll probably do:
ed -s file <<EOF
40c
Hello gniourf_gniourf
.
wq
EOF
The -s
option so that the sucker remains silent.
If you liked
ed
, you'll probably also like ex
!
Cheers!
No comments:
Post a Comment