mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Added sed
and grep
examples to useful-commands
This commit is contained in:
parent
66f62c63ca
commit
b52a32dd24
@ -9,6 +9,7 @@ contributors:
|
||||
- ["akirahirose", "https://twitter.com/akirahirose"]
|
||||
- ["Anton Strömkvist", "http://lutic.org/"]
|
||||
- ["Rahil Momin", "https://github.com/iamrahil"]
|
||||
- ["Gregrory Kielian", "https://github.com/gskielian"]
|
||||
filename: LearnBash.sh
|
||||
---
|
||||
|
||||
@ -199,4 +200,8 @@ sort file.txt
|
||||
uniq -d file.txt
|
||||
# prints only the first column before the ',' character
|
||||
cut -d ',' -f 1 file.txt
|
||||
# replaces every occurance of 'apples' with 'oranges' in file.txt
|
||||
sed -i 's/apples/oranges/g' file.txt
|
||||
# prints the number of occurances of "foo" in file.txt
|
||||
grep -c "foo" file.txt
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user