2

I've alread read this and this question, which led me to:

for f in *.Xml
do
  perl -pi.bak -e 's/\x03//g' "$f"
done
rm *.bak

I am using a for loop and I'm using -pi.bak. I still get Can't do inplace edit on 20180619.Xml: File exists.. I also tried this from Windows' cmd.exe instead of from git bash:

for %i in (*.Xml) do perl -pi.bak -e "s/\x03//g" "%i"

Same thing. Any ideas?

Version info:

$ perl --version

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-msys-thread-multi

I am using the latest version of Windows 10 Pro.

afarah
  • 748
  • 3
  • 19

1 Answers1

3

Turns out the file was open (for reading) by another process.

$ handle 20180619.Xml

Nthandle v4.11 - Handle viewer
Copyright (C) 1997-2017 Mark Russinovich
Sysinternals - www.sysinternals.com

Rgui.exe           pid: 11520  type: File           488: C:\20180619.Xml
Rgui.exe           pid: 11520  type: File           530: C:\20180619.Xml
Rgui.exe           pid: 11520  type: File           680: C:\20180619.Xml

Killing the process solves the issue.

afarah
  • 748
  • 3
  • 19