LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to read a single line from a text file into a shell script. (https://www.linuxquestions.org/questions/linux-software-2/how-to-read-a-single-line-from-a-text-file-into-a-shell-script-474475/)

SkipHuffman 08-16-2006 01:35 PM

How to read a single line from a text file into a shell script.
 
How can I pull a specified line from a plain text file in a shell script?

Basically I need to pull line X from file Y.

Assistance please.

druuna 08-16-2006 01:57 PM

Hi,

Using sed is a possibility:

LINE_FIVE="`sed -n '5p' infile`"

Hope this helps.

SkipHuffman 08-16-2006 02:10 PM

Yup, that is what I need.

Thanks!


All times are GMT -5. The time now is 07:21 AM.