I would like to have experts help on below action.
I have text files in which page nubmers exists in form like
PAGE : 1
PAGE : 2
PAGE : 3
and so on there is other text too. I would like to know is it possible to check the last occurance of Page numer and replace this value as below
PAGE : 1 of 3
PAGE : 2 of 3
PAGE : 3 of 3
Similarly I have to replace some text with blank spaces.
i.e the text is like ***Disclaimer Statement**** . Can I replace this with spaces. This text is Fixed and always occured in the end of every text file.
Regards,
Hassan
---------- Post updated at 02:53 PM ---------- Previous update was at 11:38 AM ----------
Further to update that I have tried to replace the text
***Disclaimer Statement *****
with blank spaces, but the sign * not replacing only the Alphabets were replaced I sued below code.
cd /text
find /text -name 'c*.txt' |
while read filename
do
cat $filename | sed 's/****Disclaimer Statement *****\(\)/\1/' > temp.txt
mv temp.txt $filename
done
Similarly received error
0403-057 Syntax error at line 9 : `'' is not matched.
I have tried but the page no reformatting is not working.
I have uploaded the sample file names "test.txt". Kindly note that the contents are purely dummy.
Similarly the second option's approach has changed. Now I want to replace all the text with blank lines/spaces after pharase
"NUMBER OF TRANSACTIONS"
Actually the text might be changed after time to time after this pharse, so I need to check how many lines are there having text and remove all lines with blank lines. In attachment you can view that there is 13 lines after this pharse that contains any text I want to replace these 13 lines (or any number of lines if text changes) with blank lines and the reamining blank lines after and before that text must be same.