I’m writing a shell script that outputs all untranslated strings from gettext .po file, and stuck on a simple thing. At the end of my commands chain I get such output:
"less than a minute left"
"%d minutes left"
"logged in as <a href=\"%s\">%s</a>"
"more"
And I don’t know how to echo these lines without quotes, like this:
less than a minute left
%d minutes left
logged in as <a href="%s">%s</a>
more
Note, that quotes are used inside phrases, so I can’t just remove them by sed. I wish I knew a command that unquotes such. Something more injection-safe than
awk '{ print "echo ", $0}' | sh
Just in case here’s a working demo of what I have so far:
wget https://raw.github.com/vslavik/poedit/master/locales/wa.po
msgattrib --untranslated --no-wrap wa.po | grep msgid | sed "s/msgid[^ ]*//"
Adding
's/^\s"\|"$//g'and's/\\"/"/g'to your sed command should strip off the leading and trailing", and also convert all\"to".Full command: