Tenth Line
来源:互联网 发布:软件压力测试工具 编辑:程序博客网 时间:2024/05/23 20:09
题目大意:给一个多行的文件,让你写一段shell脚本把文件的第10行输出来。
方法一:
# Read from the file file.txt and output the tenth line to stdout.count=0while read line && [ $count -le 10 ]do count=$[$count+1] if [ $count -eq 10 ] then echo $line exit fidone < file.txt
方法二:
# Read from the file file.txt and output the tenth line to stdout.sed -n '10p' file.txt
方法三:
# Read from the file file.txt and output the tenth line to stdout.awk '{if(NR==10) print $0}' file.txt方法四:(方法三的简化)
# Read from the file file.txt and output the tenth line to stdout.awk 'NR==10' file.txt
0 0
- Tenth Line
- Tenth Line
- Tenth Line
- leetcode-195 Tenth Line
- LeetCode 195 Tenth Line
- 【Leetcode Shell】Tenth Line
- Leetcode: Tenth Line
- 【leetcode~Shell】:Tenth Line
- 【leetcode~Shell】:Tenth Line
- 195 - Tenth Line
- 195. Tenth Line
- leetcode:Tenth Line 【shell】
- leetcode195. Tenth Line
- 195. Tenth Line
- Leetcode 195. Tenth Line
- 195. Tenth Line#1
- 【leetcode-shell】Tenth Line
- 195. Tenth Line
- 无秘工厂,生成app
- iOS中实现tableView的中英文排序索引
- 怎么实现iMindMap中任务信息的添加
- jquery 实现页面局部刷新ajax做法
- 圆角的图片拉伸不变形
- Tenth Line
- Android apk动态加载机制的研究(二):资源加载和activity生命周期管理
- 多说评论插件
- Spring事务管理高级应用难点剖析之多线程的困惑
- Joiner Transformation(1)
- GitHub 优秀的 Android 开源项目
- HDU 5080 Colorful Toy(polya+计算几何)
- Mybatis打印不出SQL及Maven仓库
- leetcode8--String to Integer (atoi)