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

What is ctrl d?

0 Answers  


How do I delete files from command prompt?

0 Answers  


How do you know about running processes of a particular user?

11 Answers  


Why we are using UNIX OS when we are doing the testing in our application?

5 Answers   IBM,


What is mtime in find command?

1 Answers  






Write a command that will find all text files in a directory such that it does not contain the word "amazing" in any form (that is, it must include the words amazing, amazing, or amazing)?

0 Answers  


How do I use grep to find a file?

0 Answers  


distinguish between interrupts and exceptions?

2 Answers   Infosys, Wipro,


How to use grep command to list find the records of a file containing 10 different strings?

0 Answers  


which command is used to stop a running process in unix?

8 Answers  


The rm command removes links to file. What does this mean? How then is a file deleted from the file system?

5 Answers  


If we want to see first 35 lines of a file which command we have to use?

8 Answers  


Categories