Print text at specified line number bash -


I want to print text from a file to a specified line number.

Here's my bash script

  line = 12 sed -n "$ line {p; q;}"  

Line number comes in one variable but the above code is not working What should I do?

You must give the filename as the argument of sed .

  line = 12 sed -n "$ line {p; q;}" filename  

If you assign a file script to a single bidding script , You need to use:

  line = 12 sed -n "$ line {p; q;}" "$ 1"  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -