I came across this awk command for printing the contents of a text file between two strings:
Code:
awk '/START/{flag=1;next} /END/{flag=0} flag {print}' file
But I can't figure out how to make it work with a shell variable. Actually, one variable as part of two different strings, 'name="${Dir}"' and '<!--END${Dir}-->'. A sed command does essentially the same thing, the actual command I'm using being
Code:
sed -e "1,/name=\"${Dir}\"/d" -e "/<.--END${Dir}-->/,\$d"
but this doesn't work if the 'start' line if the first line of the file. I have no idea why.
Bookmarks