Search code examples
regexunixsedspace

What actually the meaning of "-n" in sed?


According to http://linux.about.com/od/commands/l/blcmdl1_sed.htm

suppress automatic printing of pattern space

I've tested with or without -n, sed will produce same result

I dont understand what space does it means.


Solution

  • Just try a sed do-nothing:

    sed '' file
    

    and

    sed -n '' file
    

    First will print whole file but second will NOT print anything.