Tenth Line
来源:互联网 发布:智能电视专用软件 编辑:程序博客网 时间:2024/06/05 16:27
How would you print just the 10th line of a file?
For example, assume that file.txt has the following content:
Your script should output the tenth line, which is:
Hint:
1. If the file contains less than 10 lines, what should you output?
2. There's at least three different solutions. Try to explore all possibilities.
题目大意:
输出一个文件的第10行。
思考:
1. 如果文件包含内容不足10行,应该输出什么?
2. 有至少3种不同的解决方法,尝试列举所有的可能方案
Bash脚本:
解法一,使用awk
- 1
- 2
解法二,使用sed
- 1
- 2
解法三,组合使用tail与head
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
- Invalid project description. D:\workspaceforandroid\Framelaout overlaps the location of another pr
- 从数据库内部表中查询得到ORACLE_BASE变量值
- WmiPrvSE.exe内存占用异常
- highcharts各个元素功能
- 查询oracle表的信息(表,字段,约束,索引)
- Tenth Line
- 利用Hog特征和SVM分类器进行行人检测
- get请求
- Sublime Text 2下安装SFTP插件
- 第三周顺序表的应用(1)
- iOS学习笔记29-__block 与 __weak的区别理解
- Linux高可用性方案之Heartbeat安装
- nyoj 68 三点顺序
- VS2015中配置Pthread