Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 18, 2022 08:39 am GMT

Execute batch operations using xplr

Often times you need to run a command on multiple files, and often, multiple commands on multiple files.

It's possible to do it entirely in the command-line, using tools like xargs, and basic shell scripting, but xplr provides a more intuitive and interactive experience, using a plugin called map.xplr.

To use this, you need xplr and map.xplr installed. See the official install instructions.

Once installed, you can navigate to any directory, focus on the target file or select multiple files, and then press M. You will see a prompt where you can enter any command you want to run, and the file paths will be passed as arguments to the command. In case you want to run the command separately on each file, or maybe, you want to pass the paths multiple times to the same command, just press tab. It will drop you into the "map multi" mode, where you can type the command, and pass the file paths by using {} as the placeholder.

If you want to execute a more customized version of the operation, for example, you may want to run a slightly different command on a specific file, press ctrl-e. This will create a shell script containing the command and file paths that you see on screen, and open an editor to let you edit the commands interactively. Once you save and exit the script, you will be back to the xplr screen with the option to either cancel the operation by pressing escape or execute it by pressing enter.

Follow xplr.stck.me for more xplr related tips & tricks.


Original Link: https://dev.to/sayanarijit/execute-batch-operations-using-xplr-4hji

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To