vim中使用sed去除网上copy的源代码行号和空格

有些时候,在网上搜索到的代码都包含有行号,高亮显示控件不支持直接提取,如: 
test.sh 
01 #!/bin/bash 
02 echo “aaa”

简单的去掉行号和前面的空格: 
方案一: 
1.vim中删除所有行号: vim test.sh,command模式, :%s/^[0-9]*// ; 
此步可以也可以直接使用sed: sed -i ‘s/^[0-9]*//g’ test.sh 
2.使用sed删除所有行首空字符,sed -i ‘s/^[[:space:]]*//’ test.sh

方案二: 
1.notepad++, 录制宏,删除第一行的行号,然后回放宏. 
2.ultraedit 列模式. 直接删除.


网上看到的一个: 
删除/test 目录下的所有空目录文件: 
find /test -type d -empty | xargs -exec rmdir;

原文地址:https://www.cnblogs.com/mfryf/p/3578062.html