Saturday, 15 September 2012

bash - running into error with multiline sed statement -



bash - running into error with multiline sed statement -

i have long sed statement 6 lines long strung -e. doing multiple replacements , writing same file.

it throws me error sed statement on 1 line. how can rectify this?

some have suggested using variables cut down text length, still think solution won't work me. there simpler way create work?

thanks.

edit: wasn't using line breaks properly. working script:

sed -e 's/horse.*/300/g' \ -e 's/goat.*/320/g' \ -e 's/dog.*/310/g' \ -e 's/wolf.*/330/g' < "$file1" > "$file2"

thanks again.

see if works:

sed 's/horse.*/300/g;s/goat.*/320/g;s/dog.*/310/g;s/wolf.*/330/g' filename.txt

your script never ends because not feeding sed command filename.

bash shell unix sed

No comments:

Post a Comment