Solved

appending text on top of another file

Posted on 2008-10-21
2
1,303 Views
Last Modified: 2013-12-13
Dear All,
I have two files
One is script file in which I am writing commands to append a text in a normal file.
I want to insert the text on top of the file.
I dont want to use sed and awk commands nor temp file.
is it possible?
0
Comment
Question by:anju_a_sagar
2 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 250 total points
ID: 22768840
try this

ed file1 <<END
r file2
.
w
q
END

This will use the ed editor to edit file1 and include file2 at the beginning then save it then quit.
0
 
LVL 14

Assisted Solution

by:sjm_ee
sjm_ee earned 250 total points
ID: 22770819
How about cat and a "here document"?

cat - /etc/motd <<!
surprise!
!
surprise!
*******************************************************************************
*                                                                             *
*                                                                             *
*  Welcome to AIX Version 5.2!                                                *
*                                                                             *
*                                                                             *
*  Please see the README file in /usr/lpp/bos for information pertinent to    *
*  this release of the AIX Operating System.                                  *
*                                                                             *
*                                                                             *
*******************************************************************************
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

789 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