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 sort the content of the file based on numeric values

1 Answers   Epsilon,


what is the default signal kill in unix?

8 Answers   IBM,


What is file system in unix??

10 Answers   Symphony,


distinguish between interrupts and exceptions?

2 Answers   Infosys,


the difference between a soft link and a hard link?

6 Answers  


which script will invoke first ,when /etc/init.d starts

1 Answers  


what is the difference between SED and GREP ? Which one is more better and why?

4 Answers   IBM,


distinguish between multi-tasking,multi-user,multi- processing and time sharing?

7 Answers   Alcatel, Cisco, Infosys, University Exams,


What is grep command in unix with examples?

1 Answers  


How can you change the owner or group of a file?

1 Answers  


What is the general format of unix command syntax?

3 Answers  


How do I search for text in vi?

1 Answers  


Categories