summaryrefslogtreecommitdiffhomepage
path: root/bash.html.markdown
diff options
context:
space:
mode:
authorJohnathan Maudlin <maudlin.johnathan@gmail.com>2014-10-29 22:13:33 -0400
committerJohnathan Maudlin <maudlin.johnathan@gmail.com>2014-10-29 22:13:33 -0400
commit259c144eeb7b349a00891eb7bfa26ed564dfe580 (patch)
treed5620fc0ecba85da3f66d15ea0952eccfa718ebf /bash.html.markdown
parentfe277959606857f2690b4d6dd224fffc6a550d34 (diff)
parent7d0eaa855959c03b52795a7457001bbd69d88464 (diff)
Merge pull request #1 from adambard/master
Merge from upstream
Diffstat (limited to 'bash.html.markdown')
-rw-r--r--bash.html.markdown9
1 files changed, 9 insertions, 0 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index dc7d32b6..11c1f3a2 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -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,12 @@ sort file.txt
uniq -d file.txt
# prints only the first column before the ',' character
cut -d ',' -f 1 file.txt
+# replaces every occurrence of 'okay' with 'great' in file.txt, (regex compatible)
+sed -i 's/okay/great/g' file.txt
+# print to stdout all lines of file.txt which match some regex, the example prints lines which begin with "foo" and end in "bar"
+grep "^foo.*bar$" file.txt
+# pass the option "-c" to instead print the number of lines matching the regex
+grep -c "^foo.*bar$" file.txt
+# if you literally want to search for the string, and not the regex, use fgrep (or grep -F)
+fgrep "^foo.*bar$" file.txt
```