उफ़। मैंने प्रश्न को गलत समझ लिया था!
हालाँकि, यदि आप फुटनोट्स की गिनती करना चाहते हैं, और आप किसी ऐसे सिस्टम का उपयोग कर रहे हैं जिसमें unix command-line उपलब्ध हों (जैसे linux / mac / windows के लिए unix-tools), तो आप इस तरह कुछ कर सकते हैं:
cat FILENAME | tr '\\' '\n' | awk '/^f /{footnote++;}/^x /{xref++;}/^c /{print chapter, footnote, xref ; chapter=0+$2; footnote=0;xref=0;}END{print chapter, footnote, xref; }'
यह यह सुनिश्चित करता है कि प्रत्येक नया SFM एक नई लाइन से शुरू हो, और फिर फुटनोट्स, xrefs की गिनती करता है और जब अध्याय संख्या (या अंत) होती है, तो वह गिनती प्रिंट करता है। हालाँकि मैं python नहीं बोलता, और नोट्स एक XML फ़ाइल में होते हैं, जिसे awk के साथ डिकोड करना बहुत मुश्किल है।
Bother. I misunderstood the question!
Anyway, if you happened to want to count footnotes, and are using something with unix command-line tools available (e.g. linux / mac / unix-tools for windows), then you can do something like this:
cat FILENAME | tr '\\' '\n' | awk '/^f /{footnote++;}/^x /{xref++;}/^c /{print chapter, footnote, xref ; chapter=0+$2; footnote=0;xref=0;}END{print chapter, footnote, xref; }'
What it does is make sure that every new SFM starts a new line, and then counts the footnotes, xrefs and when there’s a chapter number (or the end) it prints the counts. I don’t speak python though, and notes are in an XML file which is quite a bit too nasty to decode with awk.
English से मशीन-अनुवादित