Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Append a file on top of a file

Posted on 2006-03-20
2
Medium Priority
?
329 Views
Last Modified: 2013-11-17
How am I going to append a file to the (at the top) of main file using sed? Can vi  command line be used as a background automatically? Thanks.

0
Comment
Question by:jryanlee80
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
sjm_ee earned 2000 total points
ID: 16240809
Q How am I going to append a file to the (at the top) of main file using sed?
A sed -e '1i/your text to insert/'

Q Can vi  command line be used as a background automatically?
A Not without using a tool like "expect". Whatever you want to do there is an easier way.
0
 
LVL 14

Expert Comment

by:sjm_ee
ID: 16241782
I made a small mistake:

Q How am I going to append a file to the (at the top) of main file using sed?
A sed -e '1i<your text to insert>' where <your text to insert> is what you want to put in. No delimiters are required. Always use quotes around the edit command to make sure that it is all parsed correctly as one parameter.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question