#!/bin/bash #Find out if there is a problem section but no problems by looking for the number for the problem section and then look for the template number for the problems for i in $(ls -1 PAT_*Ver2.xml) do if grep -q "11450-4" "$i" && ! grep -q "3.249.11.100.8" "$i" then #echo "$i" >> FilesWithProblemSectionsThatNeedToBeDeleted.txt #for i in $(cat FilesWithProblemSectionsThatNeedToBeDeleted.txt) #for i in $(cat FilesWithProblemSectionsThatNeedToBeDeleted.txt) #do ProblemSectionKeyLine="$(grep -n "11450-4" "$i" |awk -F: '{ print $1 }')" Arguments="$(echo "$ProblemSectionKeyLine $i")" echo "$Arguments" source LineNumberUpDownFunction read LineNumberUpDownFunction $Arguments echo "$SectionInformation" a="$(echo "$SectionInformation" | awk -F: '{ print $2 }')" #echo " $a " >> FilesWithProblemSectionsThatNeedToBeDeleted.txt b="$(echo "$SectionInformation" | awk -F: '{ print $3 }')" #echo " $b " >> FilesWithProblemSectionsThatNeedToBeDeleted.txt echo "$i Beginning line to delete is $a and ending line is $b" #echo "$i" >> FilesToProcess.txt sed -in "$a","$b"d "$i" grep -q "11450-4" "$i";echo "$?" >> SuccessOrNot.txt #done fi done