小编Jam*_*272的帖子

如何从文件中删除空行(包括制表符和空格)?

我想从文件中删除所有空行。即使该行包含空格或制表符,也应将其删除。

command-line shell text-processing files

30
推荐指数
3
解决办法
6万
查看次数

在没有 wc 的情况下计算文件夹中的文件

为什么以下脚本给出的计数为 0 而不是给出目录中存在的文件计数?

#!/bin/bash
cd /root/Jamshed/script
count=0
ls -lrt > all_files
cat all_files | while read dir
do  
    count=$(($count + 1))
done
echo $count;
Run Code Online (Sandbox Code Playgroud)

shell bash pipe

3
推荐指数
1
解决办法
4775
查看次数

标签 统计

shell ×2

bash ×1

command-line ×1

files ×1

pipe ×1

text-processing ×1