Shell 脚本:删除 test.txt 文件中行首空格
#!/bin/bash
读取 test.txt 文件
while read line do
判断行首是否有空格
if [[ $line = ' '* ]] then # 删除空格 line="${line#"${line%%[![:space:]]*}"}" fi
输出处理后的行
echo '$line' done < test.txt
原文地址: https://www.cveoy.top/t/topic/lXf4 著作权归作者所有。请勿转载和采集!