#!/usr/bin/env sh DB_PATH="$1" shift get_title() { FILE="$1" PATTERN="<[tT][iI][tT][lL][eE]>.*" #Find pattern in file grep -Eo "$PATTERN" "$FILE" | #Remove tag sed 's/<[^>]*>//g' | \ #Remove '(automake)' sed 's/(Autoconf)//g' | \ #Remove trailing space sed 's/[ ]*$//g' | \ #Remove trailing man categories sed 's/ [0-9][mx]\?$//g' | \ #Replace '&' with '&' sed 's/&/&/g' | \ # ReplACE '–' with '-' sed 's/–/-/g' | \ #Replace '<' with '<' sed 's/</