linux:shellcommands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:shellcommands [2018/05/05 12:42] – [sed] admin | linux:shellcommands [2022/10/29 16:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 361: | Line 361: | ||
* original = a regular expression describing the word to replace (or just the word itself) | * original = a regular expression describing the word to replace (or just the word itself) | ||
* new = the text to replace it with | * new = the text to replace it with | ||
- | *g = global (i.e. replace all and not just the first occurrence) | + | * g = global (i.e. replace all and not just the first occurrence) |
Below are some basic examples for searching and replaccing string< | Below are some basic examples for searching and replaccing string< | ||
cat intro | cat intro | ||
Line 367: | Line 367: | ||
The Unix operating system. Unix system | The Unix operating system. Unix system | ||
</ | </ | ||
- | * <code bash>sed ' | + | * Substitute Unix with UNIX: <code bash> |
- | The UNIX operating system. Unix system | + | sed ' |
- | * <code bash>sed --in-place ' | + | </ |
- | * <code bash>sed ' | + | The UNIX operating system. Unix system</ |
+ | * Substitute Unix with UNIX in file intro: | ||
+ | sed --in-place ' | ||
+ | </ | ||
+ | * Substitute Unix with UNIX< | ||
+ | sed ' | ||
+ | </ | ||
* example with -n option< | * example with -n option< | ||
sed -n ' | sed -n ' | ||
- | * <code bash>sed -n '/ | + | * Just print lines containing UNIX: <code bash> |
+ | sed -n '/ | ||
+ | </ | ||
* example Deleting Lines< | * example Deleting Lines< | ||
sed ' | sed ' | ||
</ | </ | ||
- | * <code bash>sed '/ | + | * Delete all lines containing UNIX:<code bash> |
+ | sed '/ | ||
+ | </ | ||
+ | * Delete all characters before string< | ||
+ | sed ' | ||
+ | </ | ||
==== awk ==== | ==== awk ==== | ||
# cat server | # cat server |
linux/shellcommands.1525524160.txt.gz · Last modified: 2022/10/29 16:15 (external edit)