Rework some sed expressions - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 7868e8a7918b2e8f03072014b7290603594f9e5c DIR parent ca0f2ce4009a8f8f2a6999fa6581df78c7e01cbb HTML Author: Quentin Rameau <quinq@fifth.space> Date: Sat, 9 Nov 2019 21:36:06 +0100 Rework some sed expressions Diffstat: M annna-start-services | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- DIR diff --git a/annna-start-services b/annna-start-services @@ -89,8 +89,7 @@ then [ "$user" = "${botname}" ] && continue uri="$(printf "%s\n" "${text}" \ - | sed 's,.*\(https\{0\,1\}://[^ ]\{1\,\}\).*,\1,' \ - | grep 'https\{0,1\}://[^ ]')" + | sed -n '/.*\(https\{0,1\}:\/\/[^ ]\{1,\}\).*/s//\1/p')" case "${text}" in *\#nospoil*) ;; @@ -99,7 +98,7 @@ then then tmpf=$(mktemp) fetch-url "${uri}" > "${tmpf}" - urititle="$(grabtitle < "${tmpf}" | sed 's@^ *@@' | cut -c -200)" + urititle="$(grabtitle < "${tmpf}" | sed 's/^ *\(.\{0,200\}\).*/\1/')" if [ -n "$urititle" ]; then case "${urititle}" in