Append a file on top of a file

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.

jryanlee80Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sjm_eeCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sjm_eeCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.