shell script

Forum: LinuxTotal Replies: 3
Author Content
saneesh

Aug 28, 2006
7:46 PM EDT
hello i am new in shell scripting..please help me. i want to know in a file how to replace one line and insert two lines in that same position
Scott_Ruecker

Aug 28, 2006
7:54 PM EDT
Here are a couple of links I found for you

http://www.linuxquestions.org

http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatur...

check out the links on the right side of the webpage, there are some great sites that have a lot of information about everything Linux.

Regards, Scott
cyber_rigger

Aug 28, 2006
8:23 PM EDT
I'm not sure what you mean. Here are two lines.

echo 1 echo 2

That you can write as one

echo 1; echo 2

or

echo 1 && echo 2

A common scripting language (and default shell) is bash. The manual page for bash has a lot of basic information.

man bash

(press q to quit the man page)

An easy text based editor for editing a script is ee (easy editor). Most distros ship with the editor nano.

Sander_Marechal

Aug 28, 2006
10:13 PM EDT
@saneesh: Look into grep and sed. Those are the programs you want for that.

@rest: I think what he's looking for is, given a file:

Quoting: aaa bbb ccc


how can he have a command that replaces bbb with ddd\neee giving the file:

Quoting: aaa ddd eee ccc

You cannot post until you login.