bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63833: sed -iSUFFIX/--in-place=SUFFIX doesn't work for absolute path


From: Sebastian Carlos
Subject: bug#63833: sed -iSUFFIX/--in-place=SUFFIX doesn't work for absolute paths if the input file(s) is not in the current directory.
Date: Fri, 2 Jun 2023 11:30:25 +0200

Environment: Arch, GNU sed version 4.9, Bash 5.1.16

Given the following:

$ mkdir test
$ cat << 'EOF' > test/shopping-list
- GNUtella (1 jar)
- GNUpcakes (12 pieces)
- GNUsabi (100 g)
- Bash potatoes (2 kg)
- Sed-a cheese (200 g)
EOF

Attempting backup to an absolute path fails with an obscure error:

$ sed --in-place=/var/tmp/*.bak 's/1 jar/2 jars/' test/shopping-list
sed: cannot rename test/shopping-list: No such file or directory

But it works if the input file is in the current directory:

$ cd test
$ sed --in-place=/var/tmp/*.bak 's/1 jar/2 jars/' shopping-list
$ diff /var/tmp/shopping-list.bak shopping-list
1c1
< - GNUtella (1 jar)
---
> - GNUtella (2 jars)

Thanks!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]