Re: [PATCH] fixup! use perl instead of sed
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- May 9, 2017, 20:43 UTC
- Message-ID
- <4cb1d101-3efa-6376-64fd-2b9090d0b0c4@kdbg.org>
- In-Reply-To
- <CACBZZX5DF6sTTYSUpYnvas925N-XsoUGrM-bYbAN_67g8-w2GQ@mail.gmail.com>
Am 09.05.2017 um 19:00 schrieb Ævar Arnfjörð Bjarmason:
> Finally, you can just use -i like you did with sed, no need for the tempfile:
Nope. Some implementations of perl attempt to remove the file that it has just opened. That doesn't work on Windows. You have to supply a backup file name as in `perl -i.bak ...` :-(
Show 5 quoted lines
> > $ echo hibar >push > $ perl -pi -e 's/([^ ])bar/$1baz/' push > $ cat push > hibaz
-- Hannes