'xargs' - execute command lines from standard input - Video Man Pages

'xargs' takes the output of one command (or contents of a file), converts it into a list of arguments, and passes that list to another command to execute.

- Run a command using the input data as arguments:
command1 | xargs command2

- Count lines in multiple files:
ls *.txt | xargs wc -l

- Cat a file and use the input data as an argument:
cat file | xargs
NOTE If no xargs command is given, xargs uses 'echo' as the command.

- The same as above except it executes the command once per argument (-n 1):
cat file | xargs -n 1

- Create 10 sequential .txt files. The '-I {}' symbolizes all the input:
seq 10 | xargs -I {} touch {}.txt

- Delete files with '.log' extension found by 'find'. The -print0 in 'find' and -0 in 'xargs' use a null character as a delimiter, ensuring filenames with spaces or special characters are handled correctly.
find . -name "*.log" -print0 | xargs -0 rm -f

- Find and delete all backup files (.bak). The '-p' option is useful for destructive operations, as it displays the command to be executed and asks for user confirmation (y/n).
find . -type f -name "*.bak" | xargs -p rm

- The '-d' option sets the delimiter (spaces by default):
ls | xargs -n 1 (Files/directories with spaces are a problem.)
ls | xargs -n 1 -d \n (Uses new line as delimiter and problem solved!)

- xargs can print (-a) the contents of a file to stdout. We can use '-p' to prompt for 'y/n' before executing. We can use '-r' to only execute if stdin is not empty.
xargs -a 1.txt
xargs -p -a 1.txt
xargs -r -p -a 1.txt

REFERENCED:
► https://gitlab.com/dwt1/vidman

WANT TO SUPPORT THE CHANNEL?
💰 Patreon: https://www.patreon.com/distrotube
💳 Paypal: https://www.paypal.com/donate/?hosted_button_id=MW3ZFGS8Q9JGW
🛍️ Amazon: https://amzn.to/2RotFFi
👕 Teespring: https://teespring.com/stores/distrotube

DT ON THE WEB:
🕸️ Website: http://distro.tube
📁 GitLab: https://gitlab.com/dwt1
🗨️ Mastodon: https://fosstodon.org/@distrotube
👫 Reddit: https://www.reddit.com/r/DistroTube/
📽️ Odysee: https://odysee.com/@DistroTube:2

FREE AND OPEN SOURCE SOFTWARE THAT I LIKE:
🌐 Brave Browser - https://brave.com/
📽️ Open Broadcaster Software: https://obsproject.com/
🎬 Kdenlive: https://kdenlive.org
🎨 GIMP: https://www.gimp.org/
💻 VirtualBox: https://www.virtualbox.org/
🗒️ Doom Emacs: https://github.com/hlissner/doom-emacs

Your support is very much appreciated. Thanks, guys! Receive SMS online on sms24.me

TubeReader video aggregator is a website that collects and organizes online videos from the YouTube source. Video aggregation is done for different purposes, and TubeReader take different approaches to achieve their purpose.

Our try to collect videos of high quality or interest for visitors to view; the collection may be made by editors or may be based on community votes.

Another method is to base the collection on those videos most viewed, either at the aggregator site or at various popular video hosting sites.

TubeReader site exists to allow users to collect their own sets of videos, for personal use as well as for browsing and viewing by others; TubeReader can develop online communities around video sharing.

Our site allow users to create a personalized video playlist, for personal use as well as for browsing and viewing by others.

@YouTubeReaderBot allows you to subscribe to Youtube channels.

By using @YouTubeReaderBot Bot you agree with YouTube Terms of Service.

Use the @YouTubeReaderBot telegram bot to be the first to be notified when new videos are released on your favorite channels.

Look for new videos or channels and share them with your friends.

You can start using our bot from this video, subscribe now to 'xargs' - execute command lines from standard input - Video Man Pages

What is YouTube?

YouTube is a free video sharing website that makes it easy to watch online videos. You can even create and upload your own videos to share with others. Originally created in 2005, YouTube is now one of the most popular sites on the Web, with visitors watching around 6 billion hours of video every month.