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

前端之家收集整理的这篇文章主要介绍了如何从文件x中读取文件到bash文件的末尾前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道如何从bash脚本中的第二行到文件末尾读取每一行csv文件

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

  1. while read line
  2. do
  3. echo -e "$line\n"
  4. done < file.csv

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

  1. tail -n +2 file.csv

man page

  1. -n,--lines=N
  2. output the last N lines,instead of the last 10
  3. ...
  4.  
  5. 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-
  6. wise,print the last N items in the file.

用英语说明:

tail -n 100打印最后100行

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

猜你在找的Bash相关文章