There will be some lines in the above file with the file named <randompattern>Templates.xml OR <randompattern>Bindings.xml
The script should search for the word "Templates" or "Bindings" in each line and if present, should return the randompattern existing before these 2 words, which kinda serve as Template or Binding name
Here is my script :
for cfilename in `cat 1.txt | sort -u`
do
filename_w_ext=`basename $cfilename`
export filename_w_ext
filename=`echo $filename_w_ext | sed 's;\(.*\)\..*;\1;'`
export filename
templatename= `echo $filename | awk -FS="Templates" '{print $1}'`
bindingname= `echo $filename | awk -FS="Bindings" '{print $1}'`
echo "filename is : " $filename
echo "templatename is : " $templatename
done
But looks like I am not getting the Tempaltes or Bindings names extracted correctl, some syntax and semantics errors.
The output should ignore all files NOT containing the patterns Templates OR Bindings. But for any line containing either the pattern Templates or Bindings, it should return an output like :
filename is : sdfsdfTemplates
templatename is : sdfsdf
OR if the pattern binding is present then should look like
filename is : sfsdfdsfsdfsdfdsfBindings.xml
bindingname is : sfsdfdsfsdfsdfdsf
I hope that clarifies. Sorry about the verbose post!