I need help using xargs (1) and bc (1) on the same line. I can do this a few lines, but I really want to find a solution on a single line.
Here is the problem: The next line will print the file.txt size
ls -l file.txt | cut -d" " -f5
And the next line will print 1450 (which is obviously 1500 - 50)
echo '1500-50' | bc
Trying to add these two together, I do this:
ls -l file.txt | cut -d" " -f5 | xargs -0 -I {} echo '{}-50' | bc
The problem is that it does not work! :)
I know that xargs is probably not the right command to use, but it is the only command I can find who can let me decide where to put the argument that I get from the channel.
This is not the first time I have problems with such a problem. It will be a big help ..
thanks
source share