to put date at the end of each line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting to put date at the end of each line
# 1  
Old 01-30-2008
to put date at the end of each line

#!/bin/ksh
if test -f file6.txt
then
rm file6.txt
fi

a=`date +"%F"`
awk '{print $0,"$a"}' file3.txt > file6.txt

-----------------------------------------------------------------

i need to append date at the end of each line in file 3 and o/p it to file6.txt
# 2  
Old 01-30-2008
MySQL to put date at end of the each line

Dear ali560045,

try this

a=`date +"%F"`
awk -v DATE="$a" '{print $0 DATE}' file3.txt > file6.txt

good luk

Pankaj
# 3  
Old 01-30-2008
Thnaks i got it..wat if i want to input the date only at file 3 and not in file 6...
# 4  
Old 01-30-2008
MySQL tu put date at the end of each line

Dear ali560045,

u r doing exactly same what u need

u need to rename the file6.txt to file3.txt

just add another line

rm file3.txt
mv file6.txt file3.txt

regards,
Pankaj
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add Date string at end of line

HOWTO Append Date String (MMYYYY) to End of Line file A.txt B.txt Output: A_052014.txt B_052014.txt (9 Replies)
Discussion started by: satish1222
9 Replies

2. Shell Programming and Scripting

Put three points at the end of a line

Hello I have a file like this Anyway, if you are sincere in finding the druid Alcuin then you're going to need ships. die with the faith that you have stood shield to shield with your brothers. To honour, to glory, to a valiant death and then on to the hall of heroes. Skal! ... (6 Replies)
Discussion started by: thailand
6 Replies

3. Shell Programming and Scripting

How to add day of week at the end of each line that shows the date?

I have a file that looks like: file1: www_blank_com 20121008153552 www_blank_com 20121008162542 www_blank_com 20121009040540 www_blank_com 20121009041542 www_blank_com 20121010113548 www_blank_com 20121011113551 www_blank_com 20121012113542 I want the new file to show the day of... (3 Replies)
Discussion started by: castrojc
3 Replies

4. UNIX for Dummies Questions & Answers

Appending Date at the end ONLY in first line of file

Hi, My requirement is to append a date in format DDMMYYYYHHMISS at the end of first line of file which is HEADER. I am trying command sed -i '1s/.*/&<date_format>/' <file_name> Where <date_format>=`date +%m%d%Y%H%M%S` I am somehow misisng the right quotes ti get this added in above... (2 Replies)
Discussion started by: sanjaydubey2006
2 Replies

5. Shell Programming and Scripting

How to use sed to put string end of line?

I have several file as below, and i want to put .txt to specific text contain ^main=EXE^cmd=run script /usr/prog/bd_, file1 7.9102 12.1528 16.3672 7.4002 ^main=EXE^cmd=run script /usr/prog/bd_123^" line 16.3672 7.3134 17.8711 6.0981 file 2 7.9102 12.1528 16.3672 7.4002 ... (8 Replies)
Discussion started by: zulabc
8 Replies

6. Shell Programming and Scripting

Using sed to put text end of line

how to use sed to put .txt end of line..my input file below file1 make=^bak12^". DEV=LONG^cmd/usr/bak/ade4^" ..................................... file 2 make=^and_LONG/bak12^". DEV=LONG^cmd/usr/bak/ban3^" .......................................... file 3... (6 Replies)
Discussion started by: zulabc
6 Replies

7. Shell Programming and Scripting

put string end of the line

I've a problem to put .h end of the line..below my input file fg_a bb fg_b bb fg_c bb fg_d aa fg_f ee and i want the output file as below fg_a.h bb fg_b.h bb fg_c.h bb fg_d.h (6 Replies)
Discussion started by: zulabc
6 Replies

8. Shell Programming and Scripting

how to put nil at the end of each records.

Hello, I have a file with 100,000 records. Each record have many fileds and used "," to split (like below): 0100,apple,john,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN, 0201,steve,2435,N,0,49,6.658,0,6.658,37.104302,0,0,0,0,0,37.104302,0,49,6.658,0,6.658,37.104302,UAE,AED... (2 Replies)
Discussion started by: happyv
2 Replies

9. Shell Programming and Scripting

Grabing Date from filename and adding to the end of each line in the file.

Hi, I have 24 .dat files something like below. The file name starts with “abc” followed by two digit month and two digit year. Is there a way to grab the month and year from each filename and append it to the end of each line. Once this is done I want to combine all the files into file... (1 Reply)
Discussion started by: rkumar28
1 Replies

10. Shell Programming and Scripting

put a semicolon at the end of each line of a file

hi, Consider there is a file containing 200 lines. please let me know which command is to be used to put a semicolon at the end of each line. if no single command is there then how it can be achieved. (1 Reply)
Discussion started by: surjyap
1 Replies
Login or Register to Ask a Question