shell去掉空白行、多余空格
2012-04-30 15:42
453 查看
去掉空白行:
tr -s ["\012"] < test.txt > newtest.txt
sed -n '/./p' temp_file5 > newtest.txt
grep . temp_file5 > newtest.txt
grep -v '^$' temp_file5 > newtest.txt
去掉多余空格:
cat test.txt | tr -s [:space:]
sed 's/__*/_/g' test.txt
这里,_表示一个空格
tr -s ["\012"] < test.txt > newtest.txt
sed -n '/./p' temp_file5 > newtest.txt
grep . temp_file5 > newtest.txt
grep -v '^$' temp_file5 > newtest.txt
去掉多余空格:
cat test.txt | tr -s [:space:]
sed 's/__*/_/g' test.txt
这里,_表示一个空格
相关文章推荐
- shell 去掉多余空格
- 去除Stirng中的空格 | List转为String | 正则去掉小数点后多余0 |获得uuid
- [Android] 对ImageView设置属性scaleType为FIT_START,如何去掉多余空白
- 去掉 deplate(Viki) 生成的 html 文件行尾多余的空格。
- 算法:去掉字符串中多余的空格
- c# 反射 去掉类中字符串属性多余空格
- 去掉多余的空格
- [Android] 对ImageView设置属性scaleType为FIT_START,如何去掉多余空白
- iOS UITableView去掉多余表格线,tableView去掉表头空白、改变导航栏背景色和标题属性
- 秀丸中去掉行末的空白(半角空格、全角空格和TAB)
- 去掉display:inline-block元素间的多余空白
- shell去掉文件中空行(空白行)的方法详解
- 字符串中去掉多余空格
- java去掉文本中多余的空格与空行实例代码
- Linux命令 - 去掉空格、去掉多余空格、大小写转换、打印列
- 字符串中去掉多余的空格
- C语言去掉字符串前后空格,中间多余空格
- ios 去掉字串中的多余空格-首尾的空格
- 从键盘输入一个英文句子,并处理:去掉最左边和最右边的空白(空格、制表符),把连续的空白替换为一个空格。
- c# 反射 去掉类中字符串属性多余空格