if we create a file, in that 10 rows(means 1,2,....9,10
like). i want 7 row exactly, which command use in unix?
plz send this question.

Answers were Sorted based on User's Feedback



if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / thomas k

please try this. it will work.
head -7 <filename> | tail -1

Is This Answer Correct ?    42 Yes 8 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / srinu gadipudi

Just try this command
awk 'NR==7{print}' fiename

Is This Answer Correct ?    20 Yes 3 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / kshitij

sed -n 7p <filename>

Is This Answer Correct ?    10 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / ramesh

head -7 <file name>|tail -1

Is This Answer Correct ?    10 Yes 2 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / kantha

Hi, If you want to display 7th line from the file, simple
way is,

$head -7 <filename>| tail -1

Thanks
Kantha

Is This Answer Correct ?    7 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / isha

Put the command in Present working dir

head -7 <filename>

Is This Answer Correct ?    16 Yes 10 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / prasad

hi isha,

this is prasad, head command displays first n lines from
the file

head -7 <filename> it displays first 7 lines, i want exact
7 line.


thanku for send this question isha.

Is This Answer Correct ?    7 Yes 4 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / deshdeep saxena

awk 'NR==7{print}' filename will give you the seventh line
as output
awk 'NR<=7[print]' filename will give you from 1st line to
the seventh line :-)

Is This Answer Correct ?    4 Yes 1 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / murthy

Hi,

Try with the below command

sed -n '7p' <file name>

Is This Answer Correct ?    1 Yes 0 No

if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command..

Answer / chinmayee

head -7 filename |tail +7

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Unix Commands Interview Questions

What is the nmap command?

0 Answers  


distinguish between paging and swapping?

1 Answers   Infosys,


What does sed command do in unix?

0 Answers  


What are grep patterns?

0 Answers  


What Command will remove a Directory in UNIX?

8 Answers   IBM,






What does pipe () return?

0 Answers  


In vi editor how do you execute unix commands?

10 Answers  


Name the unix command to find how many days the server has been up.

0 Answers  


What is awk command used for?

0 Answers  


What is awk used for?

0 Answers  


what is telnet?

6 Answers  


When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system. How can i findthe right soluion??? My pgm: #include<stdlib.h> # include <stdio.h> int main() { int pid; pid=fork(); if(pid < 0) {exit(-1);} else if(pid==0) { printf("Child Process is Sleeping ..."); sleep(10); printf("Orphan Child's Parent ID : %u ",getppid()); } else { printf("Parent Process Completed ... %u ",getpid()); exit(0); } return 0; } Output:

0 Answers  


Categories