加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何从文件x中读取文件到bash文件的末尾

发布时间:2020-12-15 19:46:19 所属栏目:安全 来源:网络整理
导读:我想知道如何从bash脚本中的第二行到文件末尾读取每一行csv文件。 我知道如何在bash中读取一个文件: while read line do echo -e "$linen"done file.csv 但是,我想从第二行开始到文件的末尾读取文件。我该如何实现? tail -n +2 file.csv 从man page: -n
我想知道如何从bash脚本中的第二行到文件末尾读取每一行csv文件。

我知道如何在bash中读取一个文件:

while read line
 do   
   echo -e "$linen"
done < file.csv

但是,我想从第二行开始到文件的末尾读取文件。我该如何实现?

tail -n +2 file.csv

从man page:

-n,--lines=N
     output the last N lines,instead of the last 10
...

If the first character of N (the number of bytes or lines)  is  a  '+',print  beginning with the Nth item from the start of each file,other-
wise,print the last N items in the file.

用英语说明:

tail -n 100打印最后100行

tail -n 100打印从行100开始的所有行

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读