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
Answer / soumendra
ans- cut -d " " -f 1-7 <file name>
by this u can get all the 7 rows of ur file.
here i give 'space" as the delimeter.
u give the delimeter as u give in the file.
by -f option u can exactly get the 1 to 7 field/rows
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / mo
Using VI editor this can be done like this.
type this command.
:1,7w <newfilename>
All Good
Mo
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / meenu
if u want first 7 rows then
head -n7 <filename>
but if you want only 7th row then
awk 'nr==7 {print}' <fileanme>
or
tail -n4 <filename>|head -n1
| Is This Answer Correct ? | 0 Yes | 6 No |
How to rename files and folders?
What does grep v grep do?
how to sort the content of the file based on numeric values
how to unzip the contents of the gzip file
why unix commands can be divided into internal and external commands?
in a growing log file how will you see the 1st 99 lines?
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:
What happens when we execute a unix command?
Which command is used to create a directory?
boot process?
what is the shell for dos,nt operating systems?
How to find the files that are accessed before 10 minutes?