mirror of
https://github.com/onceupon/Bash-Oneliner
synced 2025-03-08 17:17:18 +00:00
Grep variables with space within it
Grep variables with space within it
This commit is contained in:
parent
afc0010830
commit
1dece9ec82
1 changed files with 7 additions and 0 deletions
|
@ -39,6 +39,13 @@ grep -o -P '(?<=w1).*(?=w2)'
|
|||
grep -v bbo filename
|
||||
```
|
||||
|
||||
##### Grep variables with space within it (e.g. bbo="some strings")
|
||||
|
||||
```bash
|
||||
grep "$boo" filename
|
||||
```
|
||||
#remember to quote the variable!
|
||||
|
||||
##### Grep only one/first match (e.g. bbo)
|
||||
|
||||
```bash
|
||||
|
|
Loading…
Add table
Reference in a new issue