Shell script to append text file with today's date.

Reply

Join Date: Nov 2009
Posts: 15
Reputation: Mattpd is an unknown quantity at this point 
Solved Threads: 0
Mattpd Mattpd is offline Offline
Newbie Poster

Shell script to append text file with today's date.

 
0
  #1
18 Days Ago
Hello all.

New here. Another student looking for a little help. Technically I wouldn't consider this a homework question, as it is part of a much larger project for my class. My professor is little help so I'm here now. I hope you can help.

I have a text file, and I need to print today's date at the end of the last line and in MM/DD/YYYY format.

What is in bold is what I have trouble with.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #2
18 Days Ago
date +%m/%d/%Y will give you the proper format, but i'm not sure how you would append it to the last line.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 5
Reputation: Hilliard is an unknown quantity at this point 
Solved Threads: 0
Hilliard Hilliard is offline Offline
Newbie Poster
 
0
  #3
18 Days Ago
Originally Posted by Mattpd View Post
Hello all.

New here. Another student looking for a little help. Technically I wouldn't consider this a homework question, as it is part of a much larger project for my class. My professor is little help so I'm here now. I hope you can help.

I have a text file, and I need to print today's date at the end of the last line and in MM/DD/YYYY format.

What is in bold is what I have trouble with.

I think it depends on the circumstances, but an easy way is:

echo \ date >> file
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 6
Reputation: versatileint is an unknown quantity at this point 
Solved Threads: 1
versatileint versatileint is offline Offline
Newbie Poster
 
0
  #4
18 Days Ago
Mix sknake and hilliard solution

echo `date +%m'/'%d'/'%Y` >> file
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #5
17 Days Ago
That will append the date to a new line, not the end of the last line.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC