GNU bug report logs -
#28469
xargs arguments are not passed to grep
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28469 in the body.
You can then email your comments to 28469 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-grep <at> gnu.org
:
bug#28469
; Package
grep
.
(Fri, 15 Sep 2017 15:39:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sergiu Bordei <sergiu.bordei <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Fri, 15 Sep 2017 15:39:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
please find an error detected when is used a combination of "xargs" and
"grep", arguments {} are not substituted in grep construction:
expected results:
echo "inga"|grep -c "i"
1
user <at> box1:~$ a="i"; echo `echo "inga"|grep -c $a`
1
but was necessary tu use it in combination with xargs:
user <at> box1:~$ echo "i" | xargs -I{} echo $(echo {} ;a=$(echo {}) ; echo $a ;
echo "inga"|grep -c $a)
i i 0
user <at> box1:~$ echo "i" | xargs -I{} echo $(echo {} ;a=`echo {}` ; echo $a ;
echo "inga"|grep -c $a)
i i 0
user <at> box1:~$ echo "i" | xargs -I{} echo $(echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a)
i i 0
user <at> box1:~$ echo "i" | xargs -I{} echo `echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a`
i i 0
user <at> box1:~$ echo "i" | xargs -I{} echo `echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a`
i i 0
user <at> box1:~$ echo "i" | xargs -I{} echo `echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a`
i i 0
Thanks,
Sergiu Bordei
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-grep <at> gnu.org
:
bug#28469
; Package
grep
.
(Fri, 15 Sep 2017 16:35:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Sergiu wrote:
>> please find an error detected when is used a combination of "xargs" and
>> "grep", arguments {} are not substituted in grep construction:
I believe that all your examples, both expected (count of "1" resulting)
and apparently unexpected (outputs of "i i 0") are working as expected.
I am guessing (am I right?) that you were expecting outputs of "i i 1"
or some such from your last six more complex examples using xargs,
however that "echo inga | grep -c $a" is working on an $a value that
is still inside the $( ... ) or ` ... ` command substitution, and thus equal
to '{}', with $a not yet set to "i" by the final execution of the xargs
invocation of the output from that command substitution.
--
Paul Jackson
pj <at> usa.net
Added tag(s) notabug.
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Tue, 31 Dec 2019 19:50:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
28469 <at> debbugs.gnu.org and Sergiu Bordei <sergiu.bordei <at> gmail.com>
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Tue, 31 Dec 2019 19:50:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 29 Jan 2020 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.