How to insert data in a file at last?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to insert data in a file at last?
# 1  
Old 11-28-2012
How to insert data in a file at last?

Hi Am Using Unix ksh...

I have file name called FILE1
Have a content in a FILE as
Code:
11/01/2012
12/07/2012
--
--

I have used one variable
Code:
DATE=12/11/2012

I wants to insert DATE variable value at last line in a file

I need Output as cat FILE1
Code:
11/01/2012
12/07/2012
--
--
12/11/2012

Can you please help me....

Last edited by Scott; 11-28-2012 at 10:03 AM.. Reason: Removed weird use of code and quote tags; added proper code tags
# 2  
Old 11-28-2012
See this..

Code:
$ DATE=12/11/2012

$ cat file
11/01/2012
12/07/2012
--
--

Code:
$ echo "$DATE" >> file

Code:
$ cat file
11/01/2012
12/07/2012
--
--
12/11/2012

# 3  
Old 11-28-2012

echo `date` >>file
or
echo "$DATE" >>file
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert space or pattern between columns in a data file

I have a data file where three data sets are written in three columns. Can I increase the space between the columns without reading them? Also can I insert particular patterns, say comma between 1st and 2nd column and colon between 2nd and 3rd column? (13 Replies)
Discussion started by: hbar
13 Replies

2. Shell Programming and Scripting

Insert data between comma delimiters-large file

Having a huge file in the following format. 2,3,1,,,4 1,2,3,,,,,5, 8,7,3,4,,,, Output needed is: 2,3,1,0.0,0.0,4 1,2,3,0.0,0.0,0.0,0.0,5, 8,7,3,4,0.0,0.0,0.0, I have tried reading the file each line, using AWK to parse to find out ",," and then insert 0.0 . It works but very slow. Need... (8 Replies)
Discussion started by: wincrazy
8 Replies

3. Shell Programming and Scripting

How to insert/expand data/rows in a file, with rules??

Hi, I am rather new to Unix/Linus. I have this problem that I would like to solve using unix. Here is what I have start stop expression 1 5 15 2 6 10 I want a output like this position expression 1 15 2 25 3 ... (3 Replies)
Discussion started by: wanghlv
3 Replies

4. Emergency UNIX and Linux Support

Insert data into sql queries from a file

Hello friends, I need to insert data from a file to another. I need this to form an sql query file which will consist of 50.000 INSERT INTO sentences. my sql query file will consist of 50.000 times the below line consecutively: insert into subscriber... (6 Replies)
Discussion started by: EAGL€
6 Replies

5. Shell Programming and Scripting

insert a header in a huge data file without using an intermediate file

I have a file with data extracted, and need to insert a header with a constant string, say: H|PayerDataExtract if i use sed, i have to redirect the output to a seperate file like sed ' sed commands' ExtractDataFile.dat > ExtractDataFileWithHeader.dat the same is true for awk and... (10 Replies)
Discussion started by: deepaktanna
10 Replies

6. Shell Programming and Scripting

How to insert data into MYSql database from a text file

Hi, Need to get help from you guys about this issue. I need to insert data into MySql database from a text file which is located in other server. The text file is something look like below: Date | SubscriberNo | Call Duration 20/7/07 | 123456788 | 20 20/7/07 | 123412344 | 30 The... (4 Replies)
Discussion started by: shirleyeow
4 Replies

7. UNIX for Dummies Questions & Answers

How to insert new line in the data file using the script

Hi all, I have a test.dat file.In that file i have many lines of data. IN between some lines i want to insert a new line while running the test.ksh. Say for ex: In the dat file i have data like N001 100.00 N001 200.00 N001 300.00 N001 400.00 <== After this line i want to... (2 Replies)
Discussion started by: Sona
2 Replies

8. HP-UX

find the position in a file and insert the data there

Hi, I have a EDI data file ARROWTEST of size 18246 characters. And I want to insert some data after 4200 position in the file. How I can find the position 4200 in that file....Please advise. Regards, (5 Replies)
Discussion started by: isingh786
5 Replies

9. Shell Programming and Scripting

how to insert data in database based on text file?

Hi....can you guys help me out in this script?? Below is a text file script....called Bukom.txt and it contains these: BUKOM 20060101 2.5 2.6 2.7 2.8 2.9 2.3 2.1 BUKOM 20060102 2.4 2.5 2.6 2.7 2.7 2.6 2.4 BUKOM 20060103 2.1 ... (9 Replies)
Discussion started by: forevercalz
9 Replies

10. Shell Programming and Scripting

sed, insert data from a file to another?

Hello, I have 2 files. File1 has data I wrote, and File2 is a file created by an application. I would like to insert the data from File1 into File2, but it has to be inserted at a certain location on File2. I know I need to search for "</jsp-param> </jsp-descriptor>" But I don't know... (4 Replies)
Discussion started by: ctcuser
4 Replies
Login or Register to Ask a Question