mirror of
https://github.com/xmengnet/the-art-of-command-line.git
synced 2024-12-25 01:06:31 +08:00
Merge pull request #363 from dspinellis/env-prefix
Add command-specific environment settings
This commit is contained in:
commit
741cebe309
1 changed files with 2 additions and 0 deletions
|
@ -206,6 +206,8 @@ Notes:
|
||||||
|
|
||||||
- Know that locale affects a lot of command line tools in subtle ways, including sorting order (collation) and performance. Most Linux installations will set `LANG` or other locale variables to a local setting like US English. But be aware sorting will change if you change locale. And know i18n routines can make sort or other commands run *many times* slower. In some situations (such as the set operations or uniqueness operations below) you can safely ignore slow i18n routines entirely and use traditional byte-based sort order, using `export LC_ALL=C`.
|
- Know that locale affects a lot of command line tools in subtle ways, including sorting order (collation) and performance. Most Linux installations will set `LANG` or other locale variables to a local setting like US English. But be aware sorting will change if you change locale. And know i18n routines can make sort or other commands run *many times* slower. In some situations (such as the set operations or uniqueness operations below) you can safely ignore slow i18n routines entirely and use traditional byte-based sort order, using `export LC_ALL=C`.
|
||||||
|
|
||||||
|
- You can set a specific command's environment by prefixing its invocation with the environment variable settings, as in `TZ=Pacific/Fiji date`.
|
||||||
|
|
||||||
- Know basic `awk` and `sed` for simple data munging. For example, summing all numbers in the third column of a text file: `awk '{ x += $3 } END { print x }'`. This is probably 3X faster and 3X shorter than equivalent Python.
|
- Know basic `awk` and `sed` for simple data munging. For example, summing all numbers in the third column of a text file: `awk '{ x += $3 } END { print x }'`. This is probably 3X faster and 3X shorter than equivalent Python.
|
||||||
|
|
||||||
- To replace all occurrences of a string in place, in one or more files:
|
- To replace all occurrences of a string in place, in one or more files:
|
||||||
|
|
Loading…
Reference in a new issue