Question:
Linux: Need example of /bin/ed script with input from file?
jumpingrightin
2011-09-14 22:41:36 UTC
I have some complex editing which needs to be done to a file via a shell script on Linux. /bin/ed is a good solution for this, but I'm unable to find examples of how to using /bin/ed where it takes it's input from a file for the command. Thanks!
Four answers:
anonymous
2011-09-15 04:41:53 UTC
You can make your own examples, have two files, one the way it is and the other with the change and then run "diff -e file_one file_two >ed_file" the file ed_file will contain the commands to transform file_one into _file_two



I also added a link to some examples...
bridson
2016-12-13 11:07:44 UTC
maximum shell scripts take enter from a record via technique of utilising the redirect operators (< > and |). i can not think of of a particular occasion incredible now, yet what you're searching for could be to apply {command} < {enter record} so a good distance as saving password and stuff in it, I heavily advise against it, and that i'm additionally not sure if that is going to artwork or no longer. CVS itself isn't inquiring for the password, your CVS server is. you're able to in all probability be greater desirable off putting the server to permit CVS get admission to without password and configuring the firewall to dam requests that are coming from a various IP. additionally, except you're installation a sparkling repository or something, you need to easily would desire to checkout the 1st time. this is in all probability promting you to substantiate given which you're working checkout on an already created itemizing, particularly you need to run "cvs replace" that gets all the as much as date code and merge it with what you have.
adaviel
2011-09-14 23:20:07 UTC
I don't know ed, only sed

sed can be used with a file input e.g.

$ sed -f foo.sed blah.txt > blah2.txt
ratter_of_the_shire
2011-09-14 23:03:36 UTC
with ed/ sed you tend to write a script just for the editor, and then call it with the file from a terminal.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...