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

Explain the terms ‘system calls’ and ‘library functions’ with respect to unix commands?

0 Answers  


What does #!/ Bin sh do?

0 Answers  


What is the use of sed command in unix?

0 Answers  


What do chmod, chown, chgrp commands do?

0 Answers  


Which command is used to copy files?

0 Answers  






how to sort the content of the file based on numeric values

0 Answers   Epsilon,


what is the use of ls -l command & what is the information it gives about user ?

5 Answers  


who to change the duplex setting of network interface in command line

1 Answers  


what is Online(STM) and offline diagnostics in HP-UX?

2 Answers   HP,


How to setup Disk space as well as memory in solaris10?

4 Answers  


How to convert a hidden file to normal visible file?

8 Answers  


What is the significance of the 'tee' command?

0 Answers  


Categories