#xargs

Axel ⌨🐧🐪🚴😷 | R.I.P Natenomxtaran@chaos.social
2025-04-24

Ihr kennt doch sicher diesen Country-Song von Roger Miller über #xargs:

King of the Quote

🤓

2025-04-14

Feels a bit dangerous, but I just dealt with #git complaining about local untracked files that would be overwritten by a `git pull` by selecting the list, copying it, then doing `pbpaste | xargs rm`. I assumed I'd get asked for confirmation for each one... but it just deleted them all! Eek! #bash #xargs

Joerg Jaspert :debian:Ganneff@fulda.social
2025-04-13

Ok. Remotely cleaning a huge (>2 TB, many many files and subdirs) #Nextcloud-hosted folder (not the whole user) is *painful*. Without access to the host it runs on I am limited to either the webinterface - which breaks - or using #webdav with a tool like #rclone.

#rclone purge breaks (timeout), so rclone delete it is. Which is *slow*, really slow. Probably because the remote moves a deleted file into the (for this case) useless trashbin which can't be turned off.

At least one can use #xargs to run multiple rclones in parallel - first get a list of entries of the to-be-deleted-dir (rclone lsf), format them the way rclone expects (basically put name of remote in front) and use something like `xargs -n 1 -P0 rclone delete -v --rmdirs` on it.

Still, its running since yesterday later afternoon and we are down to 1.4Tb left, of 2Tb. Even in parallel, the webdav shit manages to delete 2 to 4 files a second only.

Axel ⌨🐧🐪🚴😷 | R.I.P Natenomxtaran@chaos.social
2025-01-29

#TIL: #xargs has an option -a to read items from a file instead of from standard input. This is perfect if you need to run xargs without a surrounding shell to provide the commonly used pipe mechanism, e.g. calling it just via exec() or similar.

My case today was with Perl's Test::Command::Simple::run_ok() in pxzgrep's TAP based test suite.

#linuxcli #cli #climagic #commandlinemagic

2024-09-25

#unix is awesome #oneliner #otd

"Hey UNIX, give me a list of all our infra projects that create databases sorted by linecount"

rg -l OLAmazonDB | xargs wc -l | sort

This message brought to you by the awesome power of #ripgrep and #xargs :)

2024-09-25

Für mehr `xargs -d'\n'`!

#xargs #shell #bash

rodmoirodmoi
2024-09-18

, , and are the holy trinity for batch processing text on :

rm-o.dev/til/sed-batch-process

2024-08-28

Today's Linux Tip: Execute Commands on Multiple Files in Linux #xargs #Linuxcommands #Linuxtips

Today's Linux Tip: Execute Commands on Multiple Files in Linux
2024-02-27

#xargs bad. might elaborate later

2024-02-27

@crmsnbleyd@emacs.ch thank you for having a solution without #xargs. it's a terrible program and there is always a way to avoid it that's more idiomatic to bash. /hj

2024-02-11

@parvXtl the #xargs equivalent in #PowerShell is powerful and amazing, but not text-based. 😉

1. You can use the FullName property _inside_ the foreach-Object:

Get-ChildItem ~\Downloads -Recurse -File | ForEach-Object { perl .\bin\sanitize-file-name.pl $_.FullName }

2. But you don't need the FullName property in modern PowerShell -- it will pass the FullName of a file to a string parameter by default:

gci ~\Downloads -Recurse -File
| % {
perl .\bin\sanitize-file-name.pl $_
}

2024-02-11

Context: tech.lgbt/@parvXtl/11147026892

"#xargs(1)" equivalent is painful in #MSWindows #Powershell; adapted from [0,1,2] to run with [3] ...

cd C:\Users\user
Get-ChildItem -Recurse '.\Downloads' -File -ErrorAction SilentlyContinue | ForEach-Object fullname | ForEach-Object { perl .\bin\sanitize-file-name.pl $_ }

... easier is to run in #WSL 1 ...

cd /mnt/C/Users/user
find ./Downloads/ -type f \
| xargs perl ./bin/sanitize-file-name.pl

# Use of wildcard.
Get-ChildItem -Recurse '.\dir' -Filter '*-*' ... | ...

... this exercise was specifically to find the Powershell syntax #FAFO #TheMoreYouKnow🌈🌟

To somewhat ease the pain, could change the program to take a list of directories with option to (not) recurse🤔🤷🏽‍♂️

---
0- Powershell glob pattern matching, 202112,
stackoverflow.com/questions/70

1- What's the equivalent of xargs in PowerShell?, 201605,
stackoverflow.com/questions/36

2- How to Filter Files and Folders Using PowerShell, delftstack.com/howto/powershel

3- Strawberry Perl, strawberryperl.com/
#parv_note

Linux GuidesLinuxGuides
2023-05-25

🐧🖥️ Heute möchten wir 5 nützliche Terminal-Kommandos oder Bausteine vorstellen, die teilweise unbekannter sind.

Welche nützlichen Tipps kennst Du noch?
Verrate es uns!


egyp7egypt
2023-04-28

Bash has a way to specify strings with escaped characters like so: $'\r\n' which gives a string containing carriage return and newline characters.

The `read` built-in can take a delimiter with the -d flag. Combining these lets you use a null character: read -d $'\0'

Useful in some of the same places you might use xargs(1).

find . -name ... -print0 | while read -d $'\0'; do ./foo "$REPLY"; done

Sal Ferrarellosalcode@phpc.social
2023-02-23

I nerd sniped myself last night with this GitHub issue github.com/codepo8/dearconsole 🤣, which resulted in me running a #jekyll site locally for the first time and crafting this #cli command with #grep #xargs and #sed

grep -rl '^tags:.*,' ./_scripts | xargs sed -i '' '/^tags:/s/,//g'

LinuxiarzeLinuxiarze
2023-01-06

W dzisiejszym, pierwszym w 2023 roku tutorialu z cyklu Porady Admina zajmiemy się programem xargs linuxiarze.pl/porady-admina-fi

2022-08-17

Every shell has its weird quirks and nushell is no exception. Still getting used to it.

I certainly prefer the ease of use of each and par-each in nushell to xargs and GNU parallel.
nushell.sh/book/parallelism.ht

I'm not willing to write any significant scripts in it yet, since the syntax could keep changing.

#commandline #nushell #xargs

Exception.Net.Uaexception@social.net.ua
2020-10-17
Завантажуємо внутрішні посилання для списку доменів з Common Crawl API
https://exception.net.ua/post/get-and-store-an-ordered-list-of-urls-from-commoncrawl-api/

#Україна #уанет #Ukraine #uanet #ExceptionNetUa #commoncrawl #linux #xargs #flock #bash #curl #jq

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst