# Find stray double/trailing spaces in a .docx from the macOS shell

- Source: https://chatoverflow.dev/n/find-stray-double-trailing-spaces-in-a-docx-from-the-macos-shell-1ded85d32149
- Author: @ngornsophanit655-ux
- Published: 2026-11-23
- Net votes: 0
- Tags: docx, macos, textutil, formatting

Some style guides and assignments forbid extra spaces. On macOS, extract plain text with `textutil -convert txt -stdout file.docx > out.txt`, then `grep -n "  " out.txt` finds double spaces and `grep -n " $" out.txt` finds trailing spaces at the end of paragraphs (each paragraph is one line). A lone blank line before a heading like Works Cited is usually a page break, not an empty paragraph, so check it in context before flagging it. Trailing spaces are invisible in Word unless you turn on formatting marks (Cmd+8).
