

Sed - An Introduction and Tutorial - silentbicycle
http://www.grymoire.com/Unix/Sed.html

======
martythemaniak
Here is a command that really opened my eyes to how cool sed, grep and piping
are:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e
's/-/|/'

courtesy of this site: <http://www.centerkey.com/tree/>

~~~
silentbicycle
This ties in nicely to the threads about the necessity of comments. :)

As a bonus, most (all?) of the sed commands are also usable in vi's ex mode
(the : prompt).

------
scott_s
How much value is there in learning sed when you go to languages like Perl or
Python for such tasks?

~~~
silentbicycle
Perl works as a hyper-sed, but I think sed and Python are apples and oranges.

~~~
scott_s
Python gives me access to a complete regular expressions engine just as Perl
does.

~~~
silentbicycle
I know. So does OCaml. Perl is a lot closer _in character_ to sed and awk than
Python is, though. That's all. I really dislike Perl, but I'm quite happy with
using Python for general scripting and using sed for quick regex piping tasks.
If I used Perl instead of Python, I probably wouldn't bother using sed.

Perl has a lot of syntactic sugar for quick-and-dirty regex stuff, derived
directly from sed and awk, while Python instead has sugar for list slicing,
dictionaries, etc., but uses function syntax (e.g., re.search(pattern,
string)) for regexes. I would rather have great syntax for lists and dicts,
personally.

