a b c d e f
3 5 7 9 10
#!/bin/bash awk '/^$/{print NR}' nowcoder.txt
grep -n '^$' nowcoder.txt | grep -Eo '[0-9]+'
cat -n nowcoder.txt | awk ' { if ( !$2 ) print $1 }'
awk '/^$/ {print NR}' awk 'NF==0{print NR}' nowcoder.txt
line = 0 while read input do ((line++)) if [[ ${#input} -eq 0 ]] then echo $line fi done < nowcoder.txt
cut 命令从文件的每一行剪切字节、字符和字段并将这些字节、字符和字段写至标准输出。 -d :自定义分隔符,默认为制表符。 -f :与-d一起使用,指定显示哪个区域。
sed -n '/^$/=' awk '/^$/{print NR}'
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题