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

boot process?

2 Answers   Atos Origin, Wipro,


How do I use grep to search for a file?

0 Answers  


How do you find which version and name of unix you are using at the command prompt?

7 Answers  


how to check a file system type

7 Answers   Wipro,


What will the following command do?

0 Answers  






How i'll delete a particular line from the file? Please give answer as soon as possible. Thanks in advance.

12 Answers   IBM,


Write a command to find all of the files which have been accessed within the last 30 days.

5 Answers   Google, IBM, Satyam,


Name the various commands that are used for the user information in unix.

0 Answers  


What command will change your prompt to myprompt?

0 Answers  


In Unix file permissions what does the second field denotes?

3 Answers  


What is the behavioural difference between cmp and diff commands?

0 Answers  


What is ‘ps’ command for?

0 Answers  


Categories