There may be times when you have finished up writing code, but need to change tabs to spaces for a file to display consistently among different computers. The
unexpand commands help you convert from spaces to tabs and tabs to spaces.
In a pipeline,
expand converts tabs to spaces. Using specific options, you can specify a number of parameters.
$ expand -t 4 sample.xml # Convert every tab into four spaces <?xml version="1.0" encoding="UTF-8"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Please do not forget me this weekend!</body> </note>
unexpand filter does the opposite - it converts spaces to tabs.
In this example, assume that each "tab" instance is four spaces.
$ unexpand -t 2 sample.xml # Convert every two spaces to a tab <?xml version="1.0" encoding="UTF-8"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Please do not forget me this weekend!</body> </note>
Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.$$ Check price
Command Line Kung Fu is packed with dozens of tips and practical real-world examples. You won't find theoretical examples in this book. The examples demonstrate how to solve actual problems. The tactics are easy to find, too. Each chapter covers a specific topic and groups related tips and examples together.$ Check price