GNU bug report logs -
#36489
possible bug by sed?
Previous Next
Reported by: Steven Abner <pheonix.sja <at> att.net>
Date: Wed, 3 Jul 2019 14:46:01 UTC
Severity: normal
Tags: moreinfo, notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #10 received at control <at> debbugs.gnu.org (full text, mbox):
tag 36489 moreinfo
stop
Hello,
On Wed, Jul 03, 2019 at 10:35:33AM -0400, Steven Abner wrote:
> Hi,
> Using:
> grep -rlI ~/Development/PheonixOS -e 'as_sys_types.h' | xargs sed -i
> 's <at> as_sys_types.h <at> as_types.h <at> g'
> on ElementaryOS did its job except it truncated a few files' last line. In
> otherwords, file ends up one line
> short, and had no replacement on that line.
> Only found problem because of had identical copies on my mac, and did same
> thing, except BSD variant:
> grep -rlI ~/Development/Pheonix -e 'as_sys_types.h' | xargs sed -i ""
> 's <at> as_sys_types.h <at> as_types.h <at> g'
> Then I verify changes by using diff command. Several files on linux lost
> last line.
> As stated in subject, 'possible', because it could belong to 'xargs'?
We'll need a bit more information to be able to diagnose this issue.
First,
which version of 'sed' are you using (try "sed --version").
If this isn't a recent version (4.7), can you also try
with version 4.7 ?
Second,
Is this reproducible?
Can you narrow it down to a single file using only "sed" (without
grep/xargs) ?
If so, can you share the file?
(To ease testing, you can add a backup extension to the "-i" parameter,
similar to bsd: "sed -i.bak [...]" - the original files will be saved).
Third,
A cursory attempt to run a similar command on my computer
did not show this issue, I tried with the following commands:
for i in a b c d e ; \
do ( seq 10 ; printf "AAA as_sys_types.h\n" ) > $i ; done
grep -rlI ./ -e 'as_sys_types.h' \
| xargs sed -i 's <at> as_sys_types.h <at> as_types.h <at> g'
regards,
- assaf
This bug report was last modified 5 years and 314 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.