![]() |
sed challange
This forum is near death. Maybe some interesting activity will restore it to life.
Challenge - write a simple sed script to reverse a string or file: :
prompt$> echo "hi there" | sed 'your script goes here'ie. the behavior should match the rev command utility. I'll post an answer on Friday.... |
I'd like to see more entries in this section also... maybe a weekly script challenge or something.
:
#!/usr/bin/sed -fir@grendel [~/code/sed]# echo "hi there" | ./s.sh ereht ih |
I came up with:
:
sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//' |
| All times are GMT -5. The time now is 9:14 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC