Get the output value of the command (as received by xargs)

Hello. I got the output value of the command ($ (command)` ``), while receiving it with xargs. I received a comment and corrected it so that it works correctly. In this example, we are checking the output value of the `` `basename command.

$ find . -name "*.txt" | xargs -I% sh -c 'echo "$(basename "%" .txt)"'
a
b
$ ls .
a.txt  b.txt

While read loop use

while readI also tried using a loop.

$ find . -name "*.txt" | while read f; do echo "$(basename "$f" .txt)"; done
a
b

Recommended Posts

Get the output value of the command (as received by xargs)
Gradually display the output of the command executed by subprocess.Popen
Get the value of the middle layer of NN
Search by the value of the instance in the list
Get the variable name of the variable as a character string.
Get the image of "Suzu Hirose" by Google image search.
[C language] [Linux] Get the value of environment variable
[Django 2.2] Sort and get the value of the relation destination
Output the output result of sklearn.metrics.classification_report as a CSV file
Save the output of GAN one by one ~ With the implementation of GAN by PyTorch ~
Get UNIXTIME at the beginning of today with a command
Get the number of digits
Filter the output of tracemalloc
Debug output of chalice command
Keras I want to get the output of any layer !!
Extract the value of dict or list as a string
Output the result of gradient descent method as matplotlib animation
How to get the pixel value of the point from the satellite image by specifying the latitude and longitude
Read the standard output of a subprocess line by line in Python
How to output the output result of the Linux man command to a file
Get and set the value of the dropdown menu using Python and Selenium
Find the definition of the value of errno
Get the number of views of Qiita
About the return value of pthread_mutex_init ()
Get the attributes of an object
About the return value of the histogram.
Get the first element of queryset
Have python read the command output
Get the value from the [Django] Form
Get the number of Youtube subscribers
[Linux] Command to get a list of commands executed in the past
Extract the TOP command result with USER and output it as CSV
I measured 6 methods to get the index of the maximum value (minimum value) of the list
Find the minimum value of a function by particle swarm optimization (PSO)
Get the return value of an external shell script (ls) with python3
How to get the "name" of a field whose value is limited by the choice attribute in Django's model
Get the column list & data list of CASTable
Get the minutes of the Diet via API
The importance of Lint as Pythonista thinks
How to get colored output to the console
Migemo version of the: find command,: mfind
Pandas of the beginner, by the beginner, for the beginner [Python]
Get the last day of the specified month
[Python] Get the character code of the file
Get the filename of a directory (glob)
[PowerShell] Get the reading of the character string
Notice the completion of a time-consuming command
Make the default value of the argument immutable
Output all the email body of the email group searched by Gmail and narrowed down
To output a value even in the middle of a cell with Jupyter Notebook
[NNabla] How to get the output (variable) of the middle layer of a pre-built network
[Scientific / technical calculation by Python] Numerical calculation to find the value of derivative (differential)
Get Unix time of the time specified by JST regardless of the time zone of the server in Python
Get only the source code of the PyPI package with pip from the command line
Get the last element of the array by splitting the string in Python and PHP