#!/bin/bash #MyFile="PAT_100904_QRDA_V1_0_0-11-03-2010_20.xml" for MyFile in $(ls -1 PAT_*_QRDA_V1_0_0-11-03-2010_20.xml); do SBL=$(grep -n "structuredBody" "$MyFile" | awk -F: '{ print $1 }') echo "the structuredBody line is $SBL" echo "$((SBL+1)) is the first line to delete" echo "$((SBL+2)) is the second line to delete" echo "a is $a" echo "b is $b" #sed -in "$a","$b"d "$MyFile" done