sed can't replace files in a different directory
See original GitHub issueshx version: 0.3.2
npm version: 6.9.0
node version: 10.16.0
I’m trying to replace some text for a file in a child folder /docs
.
I run this command:
shx sed -i 's/globals.html/index.html/g' docs/index.html
And get the error: sed: no files given
I’ve confirmed this works with the vanilla unix sed command. Steps to reproduce:
git clone https://github.com/crhistianramirez/shx-bug-repro-sed.git
cd shx-bug-repro-sed
npm install
npm run bug
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Performing a recursive find and replace with sed only changes ...
I am trying to recursively search the current directory, performing a sed replace on the first line of each .txt file found.
Read more >replace | Microsoft Learn
Reference article for the replace command, which can replace existing or add new files to a directory.
Read more >using sed to replace a string in files which are in different folders
I want to write a script which goes to each folder and replace a string(in the file *.mvw) "D3PLOT_1DForce" with the name of...
Read more >Sed doesn't take file to work at - Super User
This will cause sed to replace instances where string1 is at the beginning of the line with the string string2 for all files...
Read more >Replace Files , Skip, Let Me Decide. Windows 10 Solved
In Microsoft Windows 10, when you try to organize files, you will sometimes be surprised at the lack of options. You might even...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Following up here to summarize the discussion, for future reference. Be careful with single quotes. Windows and unix treat single quotes differently and there’s no way for shx to workaround this. Prefer double quotes instead when possible, even if that means escaping double quotes inside
package.json
.Ah I see, this is in package.json like so:
Now I see the appeal of single quotes, although I think we’ve found those don’t work.
For your specific case, you can omit quotes entirely:
But in general, yeah this is something we might document.