-   Linux - Newbie (
-   -   Read a line in a txt file with bash (

orgazmo 05-03-2005 03:45 AM

Read a line in a txt file with bash
Hi all!

First excuse me for my bad english, but i'm french.

Well... let's stick to the question. In fact I'm looking for a unix command that would allow me to display a precise line of a text file in the console in order to do a grep on an other file to check if the line is in the second file too.

I first planed to use diff to compare my files, but it does'nt match my needs.

Something like that would be perfect:

Command -line_number file.txt.

Thank you ;-)

scuzzman 05-03-2005 04:10 AM

Try this:

sed -n '#p' filename
Replace the # with a number. Hence, to return line 52, you'd use:

sed -n '52p' filename
See this: Handy one-liners for sed.

orgazmo 05-03-2005 04:14 AM

ok i'll try it right now!!!

orgazmo 05-03-2005 04:16 AM

It works well!!! thanks a lot scuzzman ;-)

All times are GMT -5. The time now is 05:33 AM.