shell - Bash - search and loop over multiple string matches -
i have complex shell script attempting write. give example describe it. have file following text:
othertextbefore wordsfront stuffbeginstuff stuffmidstuff stuffendstuff wordsback wordsfront stuffdiffbeginstuff stuffdiffmidstuff stuffdiffendstuff wordsback (repeating) othertestafter
what need search file , identify each block wrapped in wordsfront , wordsback. need take contents in found block , parsing/building of text within (basically extract begin etc. , rebuild new text file them).
i having trouble first part mostly, need know how identify each block of text , loop on each block.
#!/usr/bin/awk -f /wordsback/ {z=0} z /wordsfront/ {z=1}
output
stuffbeginstuff stuffmidstuff stuffendstuff stuffdiffbeginstuff stuffdiffmidstuff stuffdiffendstuff
Comments
Post a Comment