Sed to Delete Blank Spaces

Does anyone know how to use Sed to delete all blank spaces in a text file? I haven been trying to use the "d" delete command to do so, but can't seem to figure it out

3 Answers

What kind of "space"?

To "delete all blank spaces" can mean one of different things:

  1. delete all occurrences of the space character, code 0x20.
  2. delete all horizontal space, including the horizontal tab character, "\t"
  3. delete all whitespace, including newline, "\n" and others
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.