I have a log file and i have to parse them. i want to extract a portion of this log file means that between two regular expression anything comes would be able to capture . Like
reg="(COPY\s+role\s+\(id\,\s+name\,\s+access\_level.*)"
and
regex="END"
all lines that comes between these two regular expression should able to capture. For this i have tried
echo "Enter the file to extract"
read file
reg="(COPY\s+role\s+\(id\,\s+name\,\s+access\_level.*)"
regex="END"
if [[ $file =~ $reg ]];then
while read LINE
echo ${BASH_REMATCH[1]}
if[[ $LINE =~ $regex ]];then
break;
fi
done < $file
but i am not able to capture anything .Please suggest what to do .If i am making it more complicated than suggest me how to do this.
Aucun commentaire:
Enregistrer un commentaire