Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add new file into file 1

Status
Not open for further replies.

LcdCyn

Programmer
Feb 7, 2002
19
US
I am trying to create a script which accepts two strings. $1 is the text string I would like to add to a file and $2 is the file name. I know that one can use "sed" with the a\ option to do this. Every example I have seen of using a\ requires a separate script file in which I define the input to file. Is there some way I can do what I want to do without the extra script file?

LcdCyn
 
this will append the text to the end of a file

#!/usr/bin/ksh

TEXT=$1
FILE=$2

echo $1 >> $2

usage:
[script_name] "[text]" [filename]

note: quotes are only necessary
if the text has blank characters
inbetween words, etc.
Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top