Hello everyone,
I am wondering how to program in shell to get a part of a file by indicated (input) line number, for example, get from line 100 to line 200 in a specific file.
What command(s) should I use?
thanks in advance,
George
Hello everyone,
I am wondering how to program in shell to get a part of a file by indicated (input) line number, for example, get from line 100 to line 200 in a specific file.
What command(s) should I use?
thanks in advance,
George
Code:$ # first 10 lines
$ head foo.c
void f1 ( void **p ) {
*p = 0;
}
void f2 ( ) {
int *p1;
void *p2;
f1( &p1 );
f1( &p2 );
}
$ # a subset of lines
$ sed -n '7,9p' foo.c
void *p2;
f1( &p1 );
f1( &p2 );
Cool, thank you Salem!
Quote:
Originally Posted by Salem
regards,
George