Skip to content

Commit

Permalink
Give sed and grep example in drop-down box
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Jan 17, 2024
1 parent 13e6d7e commit f6ca3f9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/1.Simple_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ gold 1 1988 Canada Maple Leaf

This mimics the use of **grep** or **sed**, so why would one possibly need awk?

??? question "How does this mimic **grep** or **sed**?"

In `grep`, the command that does exactly the same is:

```
grep silver coins.txt
```

In `sed`, the command that does exactly the same is:

```
sed -n "/silver/p" coins.txt
```

`awk` starts to shine when the thing you want to do is more
complex then detecting lines with a text.

**Now, suppose we want to list all the coins that were minted before 1980**. We invoke Awk as follows:

``` awk hl_lines="1"
Expand Down

0 comments on commit f6ca3f9

Please sign in to comment.