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 the significance of "su" command?

3 Answers  


What is FIND, GREP and SED ? Could you please give me the difference between all the three? Where we use this commnands?

6 Answers   Polaris, Deloitte,


Name the unix command to find how many days the server has been up.

0 Answers  


How to convert a hidden file to normal visible file?

8 Answers  


Which unix command to make a new directory?

0 Answers  






which command is used to identify the type of the file?

3 Answers  


why unix operating system provides more security than other operating systems?

4 Answers  


How does one process we can start an executable file? How to get the PID process, which we started?

6 Answers  


distinguish between physical addresses and logical address?

23 Answers   TATA, TCS, CTS, Infosys, College School Exams Tests, SAX,


What are the commands in UNIX to list the files in a Directory?

0 Answers   CGI,


Which RAID Levels supported by LVM?

5 Answers  


write grep commands to select the lines that have exactly two characters

8 Answers   PSI Data Systems,






Categories