Last active
          November 10, 2016 14:04 
        
      - 
      
- 
        Save lincolnge/2645017567a3c8d7f528819bb4040f6d to your computer and use it in GitHub Desktop. 
    把 tab 改成 space 的脚本
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # 一个 tab 转为两个空格 | |
| tabToTwoSpaces() { | |
| find . -name '*.js' | grep -v 'node_modules\|build' | awk '{print $1}' | xargs sed -i '' $'s/\t/ /g' | |
| } | |
| # 四个空格转换为两个空格。 | |
| FourSpacesToTwoSpaces() { | |
| # sed -i '' -e $'s/ /\t/g' -e $'s/\t/ /g' filename.js | |
| find . -name '*.js' | grep -v 'node_modules' | awk '{print $1}' | xargs sed -i '' -e $'s/ /\t/g' -e $'s/\t/ /g' | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
NodeJS 版(一个 tab 转为两个空格):https://github.com/zilong-thu/tabs-to-spaces/blob/master/app.js