summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2019-06-04 18:01:33 +0100
committerFbenas <philbeansburton@gmail.com>2019-06-04 18:01:33 +0100
commit779f8a323842446d0fc92f0c9ab14724d10abced (patch)
tree9a7b711a19d53d78a4152f581a62d9bdd381bf6b
parentb6f2ac5debac9e9900e4fcaf270701de62d3b335 (diff)
Make sure we capture all title tags individually with grep and then take the first with head
-rwxr-xr-xtitle.bash2
1 files changed, 1 insertions, 1 deletions
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 '<title.*>.*</title>' | sed -r 's/<title[^>]*//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[^>]*>([^<]+)<\/title>' | head -1 | sed -r 's/<title[^>]*//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