to list a particular line in the file

Answers were Sorted based on User's Feedback



to list a particular line in the file..

Answer / jam

To print a specific line without using a string.

sed -n '1p' <filename>

Where 1 is teh line number

Is This Answer Correct ?    5 Yes 0 No

to list a particular line in the file..

Answer / deepak

grep -i " give_the search keyword here" (specify the directory location/file to search)

Is This Answer Correct ?    3 Yes 2 No

to list a particular line in the file..

Answer / ramesh

grep "pattern" filename

Is This Answer Correct ?    1 Yes 0 No

to list a particular line in the file..

Answer / abani_mahana

sed -n '1p' <filename>
head -n filename | tail -1
(change n as per your requirements)

Is This Answer Correct ?    0 Yes 0 No

to list a particular line in the file..

Answer / ranjitha

using head and tail command we can print the required line
as an output.

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More Unix Commands Interview Questions

Explain the read, write, and execute permissions on a UNIX directory.

5 Answers  


What are file commands?

0 Answers  


What is the first character of the output in ls l command?

0 Answers  


What is the function of grep command in unix?

0 Answers  


How do I search for text in vi?

0 Answers  






what is the difference between KILL and KILL -9?

5 Answers   Informatica, Nutanix,


What happens when we execute a unix command?

0 Answers  


Why is awk called awk?

0 Answers  


What are awk commands?

0 Answers  


Explain command to display different lines that are found when compare two files?

0 Answers  


What are the dos commands?

0 Answers  


what is mount ,tell me about mount ,how can u use in real time project??

12 Answers   Symphony,


Categories