How would you print just the 25th line in a file using
smallest shell script?

Answers were Sorted based on User's Feedback



How would you print just the 25th line in a file using smallest shell script?..

Answer / guest

head -25 filename | tail -1

Is This Answer Correct ?    14 Yes 2 No

How would you print just the 25th line in a file using smallest shell script?..

Answer / swaroopa

sed -n 25p <filename>

Is This Answer Correct ?    11 Yes 0 No

How would you print just the 25th line in a file using smallest shell script?..

Answer / alok

awk -F"|" ' NR == 25 {print} ' emp.lst

in this file | is a field seprator

Is This Answer Correct ?    0 Yes 4 No

How would you print just the 25th line in a file using smallest shell script?..

Answer / santana20142003

$ls -lrt | awk 'NR==2'

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More Shell Script Interview Questions

What are the types of script?

0 Answers  


How will you connect to a database server from linux?

0 Answers  


When we login into our account which files are executed?

3 Answers   Chip Quest,


Is scripting and coding the same thing?

0 Answers  


write a shell script to identify the given string is palindrome or not?

17 Answers   CTS, HP, IBM, InfoEst, Wipro,






Write a shell script to get current date, time, user name and current working directory.

0 Answers  


How do I read a .sh file?

0 Answers  


Hi, all Scripting professional. Q. I have written script1.sh and calling script2.sh in script1.sh file using bash shell as interpreter and my log in shell also bash shell.My code like Script1 #!/bin/bash echo "My script2 call" . script2.sh Here script2.sh file run successfully but when I have changed my interpreter bash to ksh like #!/bin/ksh Error are comming script2.sh command not found. Guid me how to call other script in our main script.

2 Answers  


Write a shell program to test whether a given number is even or odd?

8 Answers  


Is shell scripting difficult?

0 Answers  


What is the difference between bash and shell?

0 Answers  


Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.

0 Answers  


Categories