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

How to see unused port number in Solaris?

2 Answers   HCL,


What are reported commands?

0 Answers  


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

0 Answers  


Give two UNIX kernel parameters that effect an Oracle install

3 Answers   Oracle,


Which unix command to make a new directory?

0 Answers  






In UNIX, what is the command to edit contents of the file?

9 Answers  


What do chmod, chown, chgrp commands do?

0 Answers  


what is the advaantage of each user having its own copy of the shell?

2 Answers   Infosys,


distinguish between interrupts and exceptions?

2 Answers   Wipro, Infosys,


what do you understand bythe term 'de-mountable volumes'?

2 Answers   Infosys,


What is $0 bash?

0 Answers  


Is there any command in Unix, other than:ls, to list the files in a directory? The answer will be highly appreciated...

27 Answers   CGI,






Categories