Contents
What is sed scripting?
sed (“stream editor”) is a Unix utility that parses and transforms text, using a simple, compact programming language. sed was based on the scripting features of the interactive editor ed (“editor”, 1971) and the earlier qed (“quick editor”, 1965–66).
Is sed shell script?
Sed is a non-interactive [1] stream editor. It receives text input, whether from stdin or from a file, performs certain operations on specified lines of the input, one line at a time, then outputs the result to stdout or to a file. Within a shell script, sed is usually one of several tool components in a pipe.
How to write expect script with sed command?
I am writing a simple expect script for accessing to a remote server without introducing the password with the command window. I am able to access to the remote server, and there I want to modify a text file. This modification is performed with the ‘ sed ‘ command for finding a ‘keyword’, the line where this ‘keyword’ is located is deleted.
Where do I save the sed script in Telnet?
If you really need to use expect with telnet or something, how about this: save the sed script in somewhere in your remote_server, like /usr/local/bin/del_kw.sh, and then execute it by expect. I think this is more manageable way to solve your problem.
How does SED-I…work in Linux?
This is how sed -i works. You will notice that you need a write permission on /etc where a temp file will be created. To avoid it you need to explicitly create a temp file by not using -i, eg. sed -e /foo/d /etc/hosts > /tmp/hosts; mv /tmp/hosts /etc.
Why do I have to execute SED through spawn?
This modification is performed with the ‘ sed ‘ command for finding a ‘keyword’, the line where this ‘keyword’ is located is deleted. The part of the code that is giving me problems is the combination of ‘ spawn ‘ with ‘ sed ‘ is the following one Since this is doing in a expec file I have to do it through ‘spawn’ command.