From 779f8a323842446d0fc92f0c9ab14724d10abced Mon Sep 17 00:00:00 2001 From: Fbenas Date: Tue, 4 Jun 2019 18:01:33 +0100 Subject: Make sure we capture all title tags individually with grep and then take the first with head --- title.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/title.bash b/title.bash index 988f544..fcb8a83 100755 --- a/title.bash +++ b/title.bash @@ -74,7 +74,7 @@ else then grep -m1 . /tmp/$TIME.body else - cat /tmp/$TIME.body | tr '\n' ' ' | tr '\r' ' ' | grep -oiE '.*' | sed -r 's/]*//I; s/^>//I; s/<\/title>$//I' | php -r 'while(($line=fgets(STDIN)) !== FALSE) echo html_entity_decode($line, ENT_QUOTES|ENT_HTML401);' + cat /tmp/$TIME.body | tr '\n' ' ' | tr '\r' ' ' | grep -oiE ']*>([^<]+)<\/title>' | head -1 | sed -r 's/]*//I; s/^>//I; s/<\/title>$//I' | php -r 'while(($line=fgets(STDIN)) !== FALSE) echo html_entity_decode($line, ENT_QUOTES|ENT_HTML401);' fi rm /tmp/$TIME.header /tmp/$TIME.body fi -- cgit v1.2.3