Miracles of UNIX tools 
Wednesday, March 5, 2008, 11:21 PM
While "googling" around for some good examples for grep and its egrep variants (extended regular expression mode - grep -E ...) I stumbled onto this page sed.sf.net. So what is interesting about it? To be honest many of these one liners are way more powerful than i ever imagined.
Few of which are my favorite:
sed = filename | sed 'N; s/^/    /; s/ *\(.\{6,\}\)\n/\1 /'
This code from above i was always doing from shell with do echo while <<< file and it would be way to slow for some reason and with this it is much much faster as there is no forking every cycle...
sed -i
this is what most of you maybe know maybe not but it is used for edit in place so you don't need to care about something_in_sed > temp_file ; mv temp_file orig ...

But funniest thing is someone even used it to create simple games :)
Sed Games

Komentari

Dodaj komentar
Zao nam je. Novi komentari nisu dozvoljeni posle 180 dana.