如何在shell中剪切字符串的第一列(可变长度)?
字符串的前:
23006 帮助.txt
我需要 23006 作为输出
很多方法:
cut -d' ' -f1 <filename # If field separator is space
cut -f1 <filename # If field separator is tab
cut -d' ' -f1 <filename | cut -f1 # If field separator is space OR tab
awk '{print $1}' filename
while read x _ ; do echo $x ; done < filename
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)