expand
Loads a file and converts tabs to spaces.
github
- The file in jupyter notebook format on github is here
google colaboratory
- To run it on google colaboratory here expand/expand_nb.ipynb)
environment
The author’s OS is macOS, and the options are different from those of Linux and Unix commands.
When you actually run the command, the leading ! and %%bash in the first line.
!sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G95
!bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
Example usage
expnad <option> filen_ame
Typical options
- [-t N] : Specifies the number of tabs to convert.
t option.
Creates a file with tabs.
%%bash
echo -e "1\t2\t3" > temp.txt # echo -e to insert tabs into the file.
%%bash
cat -t temp.txt # Make the tabs visible with cat -t.
1^I2^I3
%%bash
expand -t 5 temp.txt
1 2 3