xargs

Using xargs command and two move commands following it

感情迁移 提交于 2019-12-23 02:09:13
问题 OS: aix shell: bsh Hi, ppl I have two types of files, one type ends with .pdf.marker and the other ends with .pdf There should be always a pair with the same name (only the extensions are different). When I move a .pdf.marker file I must also move its corresponding .pdf file. I tried something like this: find ${INPUT_LOCATION}/ -name "*.pdf.marker" | xargs -I file mv file ${OUTPUT_LOCATION}/. mv $(basename file .marker) ${OUTPUT_LOCATION}/. Then I read this: xargs with multiple commands as

xargs: git : Bad file number

拈花ヽ惹草 提交于 2019-12-22 08:06:07
问题 Anyone know what could cause this error? I am trying to create a package on git using this command: git diff -z --name-only --diff-filter=MAR 5e2a4b4 5261fe1 | xargs -s1000000 -0 git archive develop -o 'package.zip' 回答1: Apart from getting the error on ssh, which you've already ruled out, it could also be that git archive can handle a limited number of argument on the command line. You are already (suspiciously) limiting the total running length of the arguments with -s , and you indicated

centos7完全重装python和yum

谁说胖子不能爱 提交于 2019-12-22 01:41:30
python升级到3.6发现想 因为yum是基于2.7想继续给yum升级 结果弄坏了 yum也用不了,没有yum就像是断了腿的人。。。。 于是只能python和yum重装了 1、删除现有Python [root@master~]# rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ##强制删除已安装程序及其关联 [root@test ~]# whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令 [root@master ~]# whereis python ##验证删除,返回无结果 2、删除现有的yum [root@master ~]# rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps [root@master ~]# whereis yum |xargs rm -frv 创建目录python和yum用以存放rpm包 #mkdir /usr/local/src/python cd /usr/local/src/python wget http://vault.centos.org/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64

linux command xargs: maximum size of the arguments passed by it?

回眸只為那壹抹淺笑 提交于 2019-12-21 09:14:57
问题 It seems that xargs doesn't pass all the arguments at once, in says in the manual that xargs executes the command (default is /bin/echo) one or more times , I heard that the reason for this is that xargs chops the passed in arguments into groups and pass them to the command group by group. If this is correct, anyone knows how this group size is determined? Thanks 回答1: Use the --show-limits argument. It will list the existing limits on your system. $ xargs --show-limits Your environment

Shell Scripting: Using xargs to execute parallel instances of a shell function

隐身守侯 提交于 2019-12-20 12:25:37
问题 I'm trying to use xargs in a shell script to run parallel instances of a function I've defined in the same script. The function times the fetching of a page, and so it's important that the pages are actually fetched concurrently in parallel processes, and not in background processes (if my understanding of this is wrong and there's negligible difference between the two, just let me know). The function is: function time_a_url () { oneurltime=$($time_command -p wget -p $1 -O /dev/null 2>&1 1>

Shell Scripting: Using xargs to execute parallel instances of a shell function

 ̄綄美尐妖づ 提交于 2019-12-20 12:23:15
问题 I'm trying to use xargs in a shell script to run parallel instances of a function I've defined in the same script. The function times the fetching of a page, and so it's important that the pages are actually fetched concurrently in parallel processes, and not in background processes (if my understanding of this is wrong and there's negligible difference between the two, just let me know). The function is: function time_a_url () { oneurltime=$($time_command -p wget -p $1 -O /dev/null 2>&1 1>

Is there a way to uninstall multiple packages with pip?

孤街浪徒 提交于 2019-12-20 09:47:30
问题 I am attempting to remove all of the installed "pyobjc-framework"-prefixed packages. I have tried the following: % pip freeze | grep pyobjc-framework | xargs pip uninstall but this barfs because each pip uninstall requires confirmation (perhaps a way to bypass this would be a solution). Please help before I have to break down and uninstall each of these manually! Nobody wants that. 回答1: Your command should actually work if you add the -y | --yes flag to pip :-) -y, --yes Don't ask for

To understand xargs better

淺唱寂寞╮ 提交于 2019-12-20 02:30:30
问题 I want to understand the use of xargs man in Rampion's code: screen -t man /bin/sh -c 'xargs man || read' Thanks to Rampion: we do not need cat! Why do we need xargs in the command? I understand the xargs -part as follows cat nothing to xargs xargs makes a list of man -commands I have had an idea that xargs makes a list of commands. For instance, find . -type f -print0 | xargs -0 grep masi is the same as a list of commands: find fileA AND grep masi in it find fileB AND grep masi in it and so

xargs: losing output when redirecting stdout to a file in parallel mode

故事扮演 提交于 2019-12-18 17:06:13
问题 I am using GNU xargs (version 4.2.2) in parallel mode and I seem to be reliably losing output when redirecting to a file. When redirecting to a pipe, it appears to work correctly. The following shell commands demonstrates a minimum, complete, and verifiable example of the issue. I generate 2550 numbers using xargs to split it into lines of 100 args each totalling 26 lines where the 26th line contains only 50 args. # generate numbers 1 to 2550 where each number is on its own line $ seq 1 2550

wget or curl from stdin

江枫思渺然 提交于 2019-12-18 12:56:19
问题 I'd like to download a web pages while supplying URLs from stdin. Essentially one process continuously produces URLs to stdout/file and I want to pipe them to wget or curl. (Think about it as simple web crawler if you want). This seems to work fine: tail 1.log | wget -i - -O - -q But when I use 'tail -f' and it doesn't work anymore (buffering or wget is waiting for EOF?): tail -f 1.log | wget -i - -O - -q Could anybody provide a solution using wget, curl or any other standard Unix tool?