我有平面文件,我现在在该循环中使用 for 循环读取它,我想读取第一行并跳过下一行。例如
Devicename1 Ip address model
location
Devicename2 IP address model
location
Devicename3 ip address model
location
请指导我..
谢谢
我有平面文件,我现在在该循环中使用 for 循环读取它,我想读取第一行并跳过下一行。例如
Devicename1 Ip address model
location
Devicename2 IP address model
location
Devicename3 ip address model
location
请指导我..
谢谢
试试这个简单sed
的命令(这是一个 GNU 扩展):
sed 0~2d filename
first~step
: 匹配从 line first 开始的每 step'th 行。d
:删除模式空间。开始下一个循环。您可以使用一个简单的sed
命令:
sed -n 'p;n' filename
输出:
Devicename1 Ip address model
Devicename2 IP address model
Devicename3 ip address model