docx-shell-parse
यह क्या करती है
यह स्किल मानक शेल टूल्स से .docx फ़ाइलें पढ़ने के बुनियादी चरण बताती है। यह उन लोगों के लिए है जिन्हें सीमित सेटअप में Word फ़ाइल से जल्दी टेक्स्ट चाहिए।
कब इस्तेमाल करें
- ✓जब मेरे कंप्यूटर पर Word फ़ाइलों के लिए Python लाइब्रेरी इंस्टॉल न हों।
- ✓जब मुझे डिपेंडेंसी इंस्टॉल किए बिना जल्दी टेक्स्ट निकालना हो।
- ✓जब मैं कंटेनर या कम टूल्स वाले सिस्टम में काम कर रहा हूँ।
Skill का लिंक
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-shell-parse/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मुझे इस Word दस्तावेज़ का टेक्स्ट चाहिए। मैं यहाँ लाइब्रेरी इंस्टॉल नहीं कर सकता, इसलिए कृपया शेल से निकालिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI पुष्टि करता है कि फ़ाइल मौजूद है, मुख्य दस्तावेज़ XML को unzip करता है, टैग और खाली पंक्तियाँ हटाता है, और चाहे तो नतीजा फ़ाइल में सहेजता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
DOCX Shell Parsing Workaround
When you need to read content from Microsoft Word (.docx) files but python-docx or similar libraries are unavailable, use this shell-based approach to extract text reliably.
When to Use
- Python environment lacks
python-docxor similar libraries - You need quick text extraction without installing dependencies
- Working in constrained environments (containers, minimal images, etc.)
Core Technique
DOCX files are ZIP archives containing XML files. Extract and parse the main document XML:
unzip -p filename.docx word/document.xml | sed -e 's/<[^>]*>//g'
Step-by-Step Instructions
1. Verify the DOCX file exists
ls -la document.docx
2. Extract raw XML content
Use unzip -p to pipe the document.xml content directly to stdout:
unzip -p document.docx word/document.xml
3. Strip XML tags from content
Pipe through sed to remove all XML tags:
unzip -p document.docx word/document.xml | sed -e 's/<[^>]*>//g'
4. Clean up whitespace (optional)
For cleaner output, remove excessive whitespace and newlines:
unzip -p document.docx word/document.xml | \
sed -e 's/<[^>]*>//g' | \
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | \
sed -e '/^$/d'
5. Save extracted text to file
unzip -p document.docx word/document.xml | \
sed -e 's/<[^>]*>//g' > output.txt
Complete Shell Function
Add this reusable function to your scripts:
parse_docx() {
local file="$1"
if [ ! -f "$file" ]; then
echo "Error: File not found: $file" >&2
return 1
fi
unzip -p "$file" word/document.xml 2>/dev/null | \
sed -e 's/<[^>]*>//g' | \
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | \
sed -e '/^$/d'
}
# Usage: parse_docx document.docx
Limitations
- Does not preserve formatting, images, or tables structure
- May include some residual XML entity references
- Works best for simple text extraction needs
- DOCX must be a valid Office Open XML format
Verification
Confirm extraction worked by checking output:
parse_docx document.docx | head -20
Alternative: Extract to Temporary Directory
For more complex parsing needs:
tmpdir=$(mktemp -d)
unzip document.docx -d "$tmpdir"
cat "$tmpdir/word/document.xml" | sed -e 's/<[^>]*>//g'
rm -rf "$tmpdir"
अक्सर पूछे जाने वाले सवाल
Word फ़ाइल का टेक्स्ट किस हिस्से में होता है?
मुख्य सामग्री आर्काइव के अंदर word/document.xml फ़ाइल में होती है।
क्या खाली पंक्तियाँ हटाई जाती हैं?
वैकल्पिक सफ़ाई चरण अतिरिक्त स्पेस और खाली पंक्तियाँ हटाता है।
क्या नतीजा सहेजा जा सकता है?
हाँ, गाइड दिखाती है कि निकाला गया टेक्स्ट टेक्स्ट फ़ाइल में कैसे लिखें।
जानकारी
लेखक का मूल विवरण
Extract text from DOCX files using shell commands when python-docx is unavailable
repo: HKUDS/AgentPilot
लोकप्रियता
- GitHub स्टार
- 7.8k
- रैंकिंग में स्थान
- #12870
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
agentpilot
7.8kआपके एजेंट को AgentPilot से प्रोजेक्ट को चरण-दर-चरण सुधारने में मदद करती है, जिसमें बदलाव सुझाए, परखे और स्कोर किए जाते हैं।
openspace
7.8kआपके एजेंट को OpenSpace सेट करने में मदद करती है, जो एजेंट स्किल्स सहेजता और वापस लाता है, और MCP के ज़रिए आपके AI ऐप से जुड़ता है।
rsi-arena
7.8kआपके एजेंट को AIME और Terminal-Bench जैसे मानक AI बेंचमार्क टेस्ट सेट करने और चलाने में मदद करती है, ताकि सुधार के तरीकों की तुलना हो सके।
experiment-guide
7.8kआपके एजेंट को छोटे प्रयोग बनाने, उनके नतीजे पढ़ने और जाँच के दौरान उपयोगी निष्कर्ष लिखने में मदद करती है।
मिलती-जुलती skills
feishu-doc
394kयह आपके एजेंट को document टूल से Feishu क्लाउड दस्तावेज़ पढ़ने, बनाने और बदलने में मदद करती है, जिसमें टेक्स्ट, इमेज और टेबल शामिल हैं।
feishu-drive
394kयह आपके एजेंट को बॉट के साथ साझा किए गए Feishu क्लाउड फ़ोल्डर में फ़ाइलें देखने, व्यवस्थित करने और उन पर टिप्पणी करने देती है।
feishu-perm
394kयह आपके एजेंट को Feishu फ़ाइल तक किसकी पहुंच है, यह जांचने और बदलने देती है, और आपके अनुरोध के लिए सबसे छोटी अनुमति चुनती है।