Skip to content

Commit

Permalink
add: grep cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
hthuz committed Sep 18, 2024
1 parent e77d832 commit 9dc6da9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cpp/inherit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

#include <iostream>
using namespace std;
class A {
public:
int name;
A* copy() {return this;}
};

class B : public A {
};


int main() {
B* b = new B;

b->name = 3;

A* obj = b->copy();
cout << b->copy()->name << endl;
}
7 changes: 7 additions & 0 deletions doc/cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,13 @@ Commands | Description
`head -c 3 file` | Print first 3 character of the file
`head -n 20 file \| tail -10` | Print lines 10-20

## Grep

`grep -e "sth"`, with `-e`, |, +, ? etc needs to be escaped
`grep -E "sth`, with -E, no need to escape




## nohup

Expand Down

0 comments on commit 9dc6da9

Please sign in to comment.