Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
General Discussions
Switcher Hangout (Windows to Mac)
'sed -i' syntax not working for Terminal
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="will.flanagan" data-source="post: 1321404" data-attributes="member: 221601"><p>Hi,</p><p></p><p>I have a question on Terminal 2.2.1.</p><p></p><p>I have a text file, tmp.txt, with these contents:</p><p>abc</p><p>blah</p><p>efg</p><p></p><p>I am trying to understand why the following command doesn't work (to replace 'blah' with 'the'). It works fine in both bash and tcsh in linux. Perhaps there is something different going on with quotes in Terminal?</p><p></p><p>>$ sed -i '2s/blah/the/' tmp.txt</p><p>sed: 1: "tmp.txt": undefined label 'mp.txt'</p><p></p><p>Does anyone know alternative syntax to make this work in Mac Terminal?</p><p></p><p>Any help would be greatly appreciated!,</p><p>Will</p><p></p><p>P.S. This works fine, but I want to use 'sed -i' to make the change:</p><p>>$ sed '2s/blah/the/' < tmp.txt</p><p>abc</p><p>the</p><p>efg</p></blockquote><p></p>
[QUOTE="will.flanagan, post: 1321404, member: 221601"] Hi, I have a question on Terminal 2.2.1. I have a text file, tmp.txt, with these contents: abc blah efg I am trying to understand why the following command doesn't work (to replace 'blah' with 'the'). It works fine in both bash and tcsh in linux. Perhaps there is something different going on with quotes in Terminal? >$ sed -i '2s/blah/the/' tmp.txt sed: 1: "tmp.txt": undefined label 'mp.txt' Does anyone know alternative syntax to make this work in Mac Terminal? Any help would be greatly appreciated!, Will P.S. This works fine, but I want to use 'sed -i' to make the change: >$ sed '2s/blah/the/' < tmp.txt abc the efg [/QUOTE]
Verification
Post reply
Forums
General Discussions
Switcher Hangout (Windows to Mac)
'sed -i' syntax not working for Terminal
Top