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 );
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Cool, thank you Salem!
Originally Posted by Salem
regards,
George