linux:shellcommands
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:shellcommands [2017/04/18 09:38] – [rsync] 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: | + | Below are some basic examples |
| - | * Example search | + | |
| cat intro | cat intro | ||
| + | </ | ||
| The Unix operating system. Unix system | The Unix operating system. Unix system | ||
| - | + | </ | |
| - | sed ' | + | * Substitute Unix with UNIX: <code bash> |
| - | The UNIX operating system. Unix system | + | sed ' |
| - | + | </ | |
| - | sed --in-place ' | + | The UNIX operating system. Unix system</ |
| - | + | * Substitute Unix with UNIX in file intro: <code bash> | |
| - | sed ' | + | sed --in-place ' |
| + | </code> | ||
| + | * Substitute Unix with UNIX<code bash> | ||
| + | sed ' | ||
| </ | </ | ||
| * example with -n option< | * example with -n option< | ||
| - | sed -n ' | + | sed -n ' |
| - | => Just print the first 2 lines | + | * Just print lines containing UNIX: <code bash> |
| sed -n '/ | sed -n '/ | ||
| - | => Just print lines containing UNIX | + | </code> |
| * example Deleting Lines< | * example Deleting Lines< | ||
| sed ' | sed ' | ||
| - | => Delete lines 1 and 2 | + | </ |
| + | * Delete all lines containing UNIX:< | ||
| sed '/ | sed '/ | ||
| - | => Delete all lines containing UNIX | + | </code> |
| + | * Delete all characters before string< | ||
| + | sed ' | ||
| </ | </ | ||
| ==== awk ==== | ==== awk ==== | ||
linux/shellcommands.1492508291.txt.gz · Last modified: (external edit)
