#!/bin/bash if [ -z "$1" ]; then echo First parameter must be string with file paths exit fi awkloc="$(dirname "$0")/create-description.awk" # Loop through all HTML files in given directory for file in $1; do description=$(awk -f "$awkloc" $file) # Replace all "[DESCRIPTION]" text in current file with what we selected (inside description) sed -i "s/\[DESCRIPTION\]/$description/g" $file done