使用变量作为行号从bash脚本中的文件读取特定行

use*_*661 8 bash shell sed

我有一个包含大量条目的csv文件.我必须从文件中读取某些行.行号存储在名为lineno的变量中.
怎么做到这一点?它可能看起来像:

line=$(sed -n "($lineno)p")
Run Code Online (Sandbox Code Playgroud)

我想知道正确的语法来做到这一点.
谢谢

koj*_*iro 14

你几乎拥有它.

line=$(sed -n "${lineno}p" "$file")
Run Code Online (Sandbox Code Playgroud)