20240927
from
日記
20240927
20240926
20240928
sort(1)
をin-placeでやる方法
code:sh
sort -o FILENAME FILENAME
これは
POSIX準拠
FILENAME
を繰り返すのがだるかったら
{FILENAME,}
としろということらしい
ただし
Bash
の
ブレース展開
を利用するため、
Bourne shell
では利用不可
How to sort a file in-place?
sort -u
は
sort | uniq
と同じ動作をするのか気になった
What is the difference between "sort -u" and "sort | uniq"?
uniq(1)
してから
sort(1)
する、あるいはその逆はよくやる操作
そもそも
sort | uniq
は
sort(1)
に
-u
がない時代のもの
とはいえ
sort -u
もPOSIX準拠だが
IPCがないためsort -uの方が早いとされているらしい