mirror of
https://github.com/xmengnet/the-art-of-command-line.git
synced 2024-12-25 02:16:28 +08:00
Another couple uconv examples I find useful.
Always hard to remember and look up, so worth listing here.
This commit is contained in:
parent
405d4fa665
commit
1777450d82
1 changed files with 6 additions and 2 deletions
|
@ -278,9 +278,13 @@ mkdir empty && rsync -r --delete empty/ some-dir && rmdir some-dir
|
||||||
|
|
||||||
- For binary diffs (delta compression), use `xdelta3`.
|
- For binary diffs (delta compression), use `xdelta3`.
|
||||||
|
|
||||||
- To convert text encodings, try `iconv`. Or `uconv` for more advanced use; it supports some advanced Unicode things. For example, this command lowercases and removes all accents (by expanding and dropping them):
|
- To convert text encodings, try `iconv`. Or `uconv` for more advanced use; it supports some advanced Unicode things. For example:
|
||||||
```sh
|
```sh
|
||||||
uconv -f utf-8 -t utf-8 -x '::Any-Lower; ::Any-NFD; [:Nonspacing Mark:] >; ::Any-NFC; ' < input.txt > output.txt
|
# Displays hex codes or actual names of characters (useful for debugging):
|
||||||
|
uconv -f utf-8 -t utf-8 -x '::Any-Hex;' < input.txt
|
||||||
|
uconv -f utf-8 -t utf-8 -x '::Any-Name;' < input.txt
|
||||||
|
# Lowercase and removes all accents (by expanding and dropping them):
|
||||||
|
uconv -f utf-8 -t utf-8 -x '::Any-Lower; ::Any-NFD; [:Nonspacing Mark:] >; ::Any-NFC;' < input.txt > output.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
- To split files into pieces, see `split` (to split by size) and `csplit` (to split by a pattern).
|
- To split files into pieces, see `split` (to split by size) and `csplit` (to split by a pattern).
|
||||||
|
|
Loading…
Reference in a new issue