Jens Kutílek on Nostr: xargs is my favourite recent command line discovery. You can use xargs to avoid ...
xargs is my favourite recent command line discovery. You can use xargs to avoid having to write a loop to call a command on a large number of files. So let's say you want to convert a folder of TTFs to WOFF2. Will shell globbing work?
$ woff2_compress *.ttf
One argument, the input filename, must be provided.
Nope. It must be called with just one file path. With xargs, that's as easy as:
$ ls *.ttf | xargs -n1 woff2_compress
Boom!
#commandline #unix #linux
Published at
2024-10-13 09:38:13Event JSON
{
"id": "39bb60997f633e62a06e0fb9c21a9ac596ee2a8f53f9899341a75e892e515c70",
"pubkey": "4d0e951819bc49b8c2480771a0a006d807c276ae61879528b29b22055acacf16",
"created_at": 1728812293,
"kind": 1,
"tags": [
[
"t",
"commandline"
],
[
"t",
"unix"
],
[
"t",
"linux"
],
[
"proxy",
"https://typo.social/users/jenskutilek/statuses/113299442448017703",
"activitypub"
]
],
"content": "xargs is my favourite recent command line discovery. You can use xargs to avoid having to write a loop to call a command on a large number of files. So let's say you want to convert a folder of TTFs to WOFF2. Will shell globbing work?\n\n$ woff2_compress *.ttf\n One argument, the input filename, must be provided.\n\nNope. It must be called with just one file path. With xargs, that's as easy as:\n\n$ ls *.ttf | xargs -n1 woff2_compress\n\nBoom!\n#commandline #unix #linux",
"sig": "5ffe0d2a3a791d403e0c4343304dd603aca13151835477c4acd57434b50407de460390a4bbeedbad83ff48b6800c1eb53fc15a02478891fd5ef4b44c0fc61474"
}