我有两个文件,一个文件是我的数据,另一个文件是我想从数据文件中提取的行号列表。我可以使用 awk 读取我的行文件,然后提取与行号匹配的行吗?
示例:数据文件:
This is the first line of my data
This is the second line of my data
This is the third line of my data
This is the fourth line of my data
This is the fifth line of my data
行号文件
1
4
5
输出:
This is the first line of my data
This is the fourth line of my data
This is the fifth line of my data
我只使用过命令行 awk 和 sed 来处理非常简单的事情。这超出了我的范围,我已经在谷歌上搜索了一个小时而没有答案。