Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ echo "Today is XX" | sed -e "s/XX/$(date +%F)/"
- Today is 2012-10-11
- s/XX/Thursday/
- $ echo "Today is XX" | sed -f replacements.sed
- Today is Thursday
- s/XX/$(date +%F)/
- $ echo "Today is XX" | sed -f replacements.sed
- Today is $(date +%F)
- cat <<! > replacements.sed
- /XX/{s//'"$(date +%F)"'/;s/.*/echo '&'/e}
- !
- echo "Today is XX" | sed -f replacements.sed
- cat <<! > replacements.sed
- /XX/{
- s//'"$(date +%F)"'/
- s/.*/echo '&'/
- }
- !
- echo "Today is XX" | sed -f replacements.sed | sh
- aaa
- bbb
- ccc
- #!/bin/sh
- STRING="${1////\/}" # using parameter expansion to prevent / collisions
- shift
- sed "
- s/aaa/$STRING/
- " "$@"
- ./sed.sh "fo/obar" <file path>
- fo/obar
- bbb
- ccc
- [ghoti@pc ~/tmp]$ cat scr.sed
- 1{;h;d;};/^--$/g
- [ghoti@pc ~/tmp]$ sed -f scr.sed <(date '+%Y-%m-%d'; printf 'foon--nbarn')
- foo
- 2012-10-10
- bar
- [ghoti@pc ~/tmp]$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement