docx-shell-extract
하는 일
이 스킬은 .docx 파일의 압축을 풀고 표준 명령줄 도구로 마크업을 제거해 읽는 방법을 보여 줍니다. 추가 소프트웨어를 설치하지 않고 Word 텍스트가 필요한 사람에게 맞습니다.
사용하는 경우
- ✓내 컴퓨터에 python-docx 같은 라이브러리가 없을 때.
- ✓아무것도 설치하지 않고 Word 파일에서 빠르게 텍스트를 뽑고 싶을 때.
- ✓제한된 환경이라 셸 도구만 쓸 수 있는 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/docx-shell-extract/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 Word 파일의 텍스트가 필요하고, 추가 소프트웨어는 설치할 수 없습니다. 명령줄로 꺼내 주시겠어요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
.docx 파일은 XML이 들어 있는 zip 압축 파일입니다. AI는 주 문서 XML을 꺼내고, 태그와 빈 줄을 지운 뒤 결과를 일반 텍스트로 저장합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
DOCX Shell Extraction
When to Use This Skill
Use this pattern when you need to read or extract text from Microsoft Word (.docx) files in constrained environments where:
- The
python-docxlibrary is not available - You cannot install additional Python packages
- You need a quick, reliable shell-based solution
Core Technique
DOCX files are ZIP archives containing XML files. The main document content is stored in word/document.xml. You can extract and parse this using standard shell tools.
Step-by-Step Instructions
Step 1: Extract the document.xml content
unzip -p filename.docx word/document.xml
The -p flag pipes the content to stdout without extracting to disk.
Step 2: Strip XML tags to get plain text
unzip -p filename.docx word/document.xml | sed 's/<[^>]*>//g'
This removes all XML tags, leaving the text content.
Step 3: Clean up whitespace (optional)
For cleaner output, add additional sed processing:
unzip -p filename.docx word/document.xml | \
sed 's/<[^>]*>//g' | \
sed 's/&[^;]*;//g' | \
sed 's/^[[:space:]]*//' | \
sed 's/[[:space:]]*$//' | \
sed '/^$/d'
This removes:
- XML tags
- XML entities (like
&,<) - Leading/trailing whitespace
- Empty lines
Step 4: Save to a text file (optional)
unzip -p filename.docx word/document.xml | \
sed 's/<[^>]*>//g' > output.txt
Complete Example
# Extract text from a Word document
DOCX_FILE="report.docx"
OUTPUT_FILE="report_text.txt"
unzip -p "$DOCX_FILE" word/document.xml | \
sed 's/<[^>]*>//g' | \
sed 's/&[^;]*;//g' | \
sed '/^$/d' > "$OUTPUT_FILE"
echo "Extracted text saved to $OUTPUT_FILE"
Verification
After extraction, verify the content was captured:
# Check if output file has content
if [ -s "$OUTPUT_FILE" ]; then
echo "Successfully extracted $(wc -l < "$OUTPUT_FILE") lines"
head -5 "$OUTPUT_FILE"
else
echo "Warning: Output file is empty"
fi
Limitations
- This method extracts raw text without formatting
- Complex layouts, tables, and images are not preserved
- Some special characters may need additional handling
- Works best for text-heavy documents
Alternatives to Explore
If this approach fails or the DOCX structure differs:
- Check for
word/document.xmlexistence:unzip -l filename.docx | grep document.xml - Some documents may use
word/*.xmlwith different naming - Consider
pandocif available:pandoc filename.docx -t plain
자주 묻는 질문
Word 파일이 zip처럼 동작하는 이유는 무엇인가요?
.docx 파일은 문서 내용을 담은 XML 파일들이 들어 있는 zip 압축 파일입니다.
서식과 표가 유지되나요?
이 방법은 마크업을 제거하므로 원래 배치가 아니라 일반 텍스트를 반환합니다.
결과를 저장할 수 있나요?
네, 가이드는 추출한 텍스트를 텍스트 파일로 쓰는 방법을 보여 줍니다.
상세 정보
작성자의 원본 설명
Extract text from DOCX files using shell commands when python-docx is unavailable
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12867
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.