linux 中利用变量作为行号删除指定的行

 

1、

root@PC1:/home/test3# ls
a.txt
root@PC1:/home/test3# cat a.txt
1 e d
2 a g
3 w e
4 d g
5 g j
6 e j
7 l m
8 i n
root@PC1:/home/test3# a=3                            ## 行号  3
root@PC1:/home/test3# b=6                            ## 行号  6
root@PC1:/home/test3# sed $(($a)),$(($b))d a.txt     ## 利用变量作为行号删除指定的行
1 e d
2 a g
7 l m
8 i n

 

posted @ 2022-06-20 11:27  小鲨鱼2018  阅读(124)  评论(0编辑  收藏  举报