Skip to content

Commit e48b0fe

Browse files
updates for version 2.5
1 parent dfa1eac commit e48b0fe

13 files changed

Lines changed: 150 additions & 123 deletions

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Sundeep Agarwal
3+
Copyright (c) 2025 Sundeep Agarwal
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎README.md‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# CLI text processing with GNU grep and ripgrep
22

3-
Example based guide to mastering GNU grep and ripgrep. Visit https://youtu.be/MSbGokwHm-A for a short video about the book.
3+
Learn GNU grep and ripgrep with hundreds of examples and exercises. Visit https://youtu.be/MSbGokwHm-A for a short video about the book.
44

55
<p align="center"><img src="./images/grep_ls.png" alt="CLI text processing with GNU grep and ripgrep ebook cover image" /></p>
66

7-
The book also includes exercises to test your understanding, which are presented together as a single file in this repo — [Exercises.md](./exercises/Exercises.md)
7+
The book also includes exercises to test your understanding, which are presented together as a single file in this repo — [Exercises.md](./exercises/Exercises.md).
88

99
For solutions to the exercises, see [Exercise_solutions.md](./exercises/Exercise_solutions.md).
1010

@@ -20,15 +20,14 @@ See [Version_changes.md](./Version_changes.md) to keep track of changes made to
2020
* https://learnbyexample.gumroad.com/l/gnugrep_ripgrep
2121
* https://leanpub.com/gnugrep_ripgrep
2222
* You can also get the book as part of these bundles:
23-
* **All books bundle** bundle from https://learnbyexample.gumroad.com/l/all-books
24-
* Includes all my programming books
25-
* **Magical one-liners** bundle from https://learnbyexample.gumroad.com/l/oneliners or https://leanpub.com/b/oneliners
26-
* **Awesome Regex** bundle from https://learnbyexample.gumroad.com/l/regex or https://leanpub.com/b/regex
23+
* **All books bundle** bundle from https://leanpub.com/b/learnbyexample-all-books or https://learnbyexample.gumroad.com/l/all-books
24+
* **Magical one-liners** bundle from https://leanpub.com/b/oneliners or https://learnbyexample.gumroad.com/l/oneliners
25+
* **Awesome Regex** bundle from https://leanpub.com/b/regex or https://learnbyexample.gumroad.com/l/regex
2726
* See https://learnbyexample.github.io/books/ for a list of other books
2827

2928
For a preview of the book, see [sample chapters](./sample_chapters/gnu_grep_sample.pdf).
3029

31-
The book can also be [viewed as a single markdown file in this repo](./gnu_grep.md). See my blogpost on [generating pdfs from markdown using pandoc](https://learnbyexample.github.io/customizing-pandoc/) if you are interested in the ebook creation process.
30+
The book can also be [viewed as a single markdown file in this repo](./gnu_grep.md). See my blogpost on [generating pdf/epub from markdown using pandoc](https://learnbyexample.github.io/customizing-pandoc/) if you are interested in the ebook creation process.
3231

3332
For the web version of the book, visit https://learnbyexample.github.io/learn_gnugrep_ripgrep/
3433

@@ -38,7 +37,7 @@ For the web version of the book, visit https://learnbyexample.github.io/learn_gn
3837

3938
⚠️ ⚠️ Please DO NOT submit pull requests. Main reason being any modification requires changes in multiple places.
4039

41-
I would highly appreciate if you'd let me know how you felt about this book. It could be anything from a simple thank you, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.
40+
I would highly appreciate it if you'd let me know how you felt about this book. It could be anything from a simple thank you, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.
4241

4342
You can reach me via:
4443

‎Version_changes.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<br>
22

3+
### 2.5
4+
5+
* Command versions updated to **GNU grep 3.11** and **ripgrep 14.1.1**
6+
* Updated some of the examples, descriptions, external links and timing results
7+
* Added Hyperlink section for the `ripgrep` command
8+
9+
<br>
10+
311
### 2.0
412

513
* Command versions updated to **GNU grep 3.10** and **ripgrep 13.0.0**

‎code_snippets/Frequently_used_options.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ grep -Fvxf colors_1 colors_2
148148

149149
grep -Fvxf colors_2 colors_1
150150

151-
## Extract only matching portion
151+
## Extract only the matching portions
152152

153153
grep -oi 'the' ip.txt
154154

‎code_snippets/Gotchas_and_Tricks.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ echo '5*3-2=13' | grep -- '-2'
3030

3131
printf -- '-2+3=1\n'
3232

33-
printf 'boat\nsite\nfoot' | grep '[aeo]+t'
33+
printf 'boat\nsite\nfoot' | grep -o '[aeo]+t'
3434

35-
printf 'boat\nsite\nfoot' | grep '[aeo]+t' -E
35+
printf 'boat\nsite\nfoot' | grep -o '[aeo]+t' -E
3636

3737
## Word boundary differences
3838

‎code_snippets/Introduction.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## Installation
22

3-
wget https://ftp.gnu.org/gnu/grep/grep-3.10.tar.xz
3+
wget https://ftp.gnu.org/gnu/grep/grep-3.11.tar.xz
44

5-
tar -xf grep-3.10.tar.xz
5+
tar -xf grep-3.11.tar.xz
66

7-
cd grep-3.10/
7+
cd grep-3.11/
88

99
./configure
1010

‎code_snippets/Perl_Compatible_Regular_Expressions.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ echo "$s" | grep -oP '(?<=\b[a-z]{1,3})\d+'
176176

177177
echo 'cat scatter cater scat' | grep -oP '(?<=(cat.*?){2})cat[a-z]*'
178178

179-
## Set start of matching portion with \K
179+
## Set the start of matching portion with \K
180180

181181
echo 'apple=42, fig=314' | grep -oP '=\K\d+'
182182

‎code_snippets/ripgrep.sh‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
link='https://github.com/BurntSushi/ripgrep/releases/'
44

5-
link="$link"'download/13.0.0/ripgrep_13.0.0_amd64.deb'
5+
link="$link"'download/14.1.1/ripgrep_14.1.1-1_amd64.deb'
66

77
wget "$link"
88

9-
sudo gdebi ripgrep_13.0.0_amd64.deb
9+
sudo gdebi ripgrep_14.1.1-1_amd64.deb
1010

1111
rg --version
1212

@@ -60,6 +60,10 @@ rg 'say' ip.txt search.txt | cat -
6060

6161
rg -NI --no-heading 'say' ip.txt search.txt
6262

63+
## Hyperlink
64+
65+
rg --hyperlink-format=default 'say' ip.txt search.txt
66+
6367
## Field separator
6468

6569
rg --field-match-separator ')' 'the' ip.txt
@@ -226,9 +230,9 @@ echo 'a cat and a dog' | rg '(?x)t a'
226230

227231
echo 'a cat and a dog' | rg '(?x)t\ a'
228232

229-
echo 'foo a#b 123' | rg -o '(?x)a#.'
233+
echo 'fig a#b 123' | rg -o '(?x)a#.'
230234

231-
echo 'foo a#b 123' | rg -o '(?x)a\#.'
235+
echo 'fig a#b 123' | rg -o '(?x)a\#.'
232236

233237
## Unicode
234238

‎exercises/Exercise_solutions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ Adios amigo
472472
473473
# Recursive search
474474
475-
>![info](../images/info.svg) Use the `recursive.sh` script from the [exercises](https://github.com/learnbyexample/learn_gnugrep_ripgrep/tree/master/exercises) directory for this section. Unless otherwise mentioned, assume you need to use the `-r` option instead of the `-R` option.
475+
>![info](../images/info.svg) Use the `recursive.sh` script from the [exercises](https://github.com/learnbyexample/learn_gnugrep_ripgrep/tree/master/exercises) directory for this section. Unless otherwise mentioned, assume you need to use the `-r` option instead of `-R`.
476476
>
477477
> ```bash
478478
> # change to the 'exercises' directory and source the 'recursive.sh' script

‎exercises/Exercises.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ Adios amigo
423423
424424
# Recursive search
425425
426-
>![info](../images/info.svg) Use the `recursive.sh` script from the [exercises](https://github.com/learnbyexample/learn_gnugrep_ripgrep/tree/master/exercises) directory for this section. Unless otherwise mentioned, assume you need to use the `-r` option instead of the `-R` option.
426+
>![info](../images/info.svg) Use the `recursive.sh` script from the [exercises](https://github.com/learnbyexample/learn_gnugrep_ripgrep/tree/master/exercises) directory for this section. Unless otherwise mentioned, assume you need to use the `-r` option instead of `-R`.
427427
>
428428
> ```bash
429429
> # change to the 'exercises' directory and source the 'recursive.sh' script

0 commit comments

Comments
 (0)