This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| sysadminery:sed [2025/05/06 15:38] – created adam | sysadminery:sed [2025/11/18 08:05] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| | | ||
| - | and since i'm sure you forgot: load is " | + | and since I'm sure you forgot: load is " |
| - | anyway, let's get one of those numbers. Here's the sed command: | + | anyway, let's get one of those numbers. Here' |
| + | |||
| + | <code regex> | ||
| + | ^.*load average: (([\d\.]){3, | ||
| + | </ | ||
| + | |||
| + | Here's (uptime piped to) the sed command: | ||
| <code bash> | <code bash> | ||
| Line 16: | Line 22: | ||
| * escape the brackets. | * escape the brackets. | ||
| * there is no '' | * there is no '' | ||
| - | * don't escape the dot. | + | * don't escape the dot, to literally match '' |
| * escape the braces. | * escape the braces. | ||
| - | * Now, outside of the brackets, don't escape the dot. You'll notice that not escaping the dot now does the opposite. | + | * Now, outside of the brackets, don't escape the dot to match the wildcard character. You'll notice that not escaping the dot now does the opposite. |
| * capture group 1 is not '' | * capture group 1 is not '' | ||