[help] perl one-liners

SkivviS

Veteran X
trying to just append a closing paragraph tag "</p>" to the end of every line in a file using:
perl -pe s/$/\<\/p\>/ < text.txt > temp.txt

running this gives me: Substitution replacement not terminated at -e line 1.

if i try:
perl -pe 's/$/\<\/p\>/' < text.txt > temp.txt
i get: Can't find string terminator "'" anywhere before EOF at -e line 1.

any ideas?
 
Last edited:
use sed ?

cat lol | sed "s/$/<\/p>/"
lsidjflj'isjfda</p>
ijdsa</p>
fijdsiajfdisjaf</p>
idsjf</p>
adsij</p>
 
or just put the regular expression in quotes apparetly

perl -pe 's/$/<\/p>/' lol
lsidjflj'isjfda</p>
ijdsa</p>
fijdsiajfdisjaf</p>
idsjf</p>
adsij</p>
 
used sed and it worked as i needed, so thanks.

sed -i -e "s/$/<\/p>/" text.txt ~for in-line editing~

but any idea why the perl command was failing?
 
Last edited:
Back
Top