Q:

How to add lines using command line

I have an HTML doc in which I want to insert automatically an image just after the body tag:
The html:
<body>
    <div class="indexHeader"><a href="allclasses-frame.html" target="packageFrame">All Classes</a>
</div>
....

And just after the <body> tag I want to add using command lines an image, and it will result like this:
<body>
    <img src="resources/logo_small.png" alt="My image" height="80" />
    <div class="indexHeader"><a href="allclasses-frame.html" target="packageFrame">All Classes</a></div>

How can I achieve this in command lines?
Note: I'm using Windows.
These are my tries:
First try:
awk -v image='<img src="resources/logo_small.png" alt="My image" height="80" />' '1; /<body>/ {print image}' overview-frame.html

As a result: 
The system cannot find the specified file.
Second try:
sed 's?<body>?<body>\n\t<img src="resources/logo_small.png" alt="My image" height="80" />?g' overview-frame.html

As a result:
The system cannot find the specified file.

A:

For this particular purpose, you can use sed that way:
sed 's?<body>?<body>\n\t<img src="resources/logo_small.png" alt="My image" height="80" />?g' filename

where filename is the file containing html code. The previous line will print the updated file on screen, but it will not save the modification in the file: use -i option of sed to do this.
This solution is very specific to the problem you exposed, if you want a more complex modification, read man sed or google for sed examples.

