Originally posted by druuna
Sed's output is to stdout, you need to redirect the output to a file (do not use the same filename!!!).
$ sed '2i\add' auto.test > auto.test.out
$ cat auto.test.out
If file is ok:
$ mv auto.test.out auto.test
Do not use the same name for the infile and outfile (sed 4.x has a parameter for this).
Hope this helps.
Thank you for your reply.....now this is a inserting operation if we hard code the
string in sed statement but what if I would like to change string dynamically
depending on users request...
I hope I am clear here....otherwise I will just repeat myself..
All I am trying is ...how can I insert a string(that can be different each time
user types in) dynamically into a file....I realized that using sed command that
string has to be hard coded...so I am looking to insert dynamically....