Solved

convert all date stamps in a file using shell or perl from 02/03/2011 to 02/03/2011 format

Posted on 2011-09-02
5
289 Views
Last Modified: 2012-05-12
I want to convert all date stamps in a file using shell or perl from 02/03/2011 to 02/03/2011 format. This will modify the file not create a separate output file.
0
Comment
Question by:libertyforall2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 36476466
You need to clarify your question as you've used the same date format.

Are you wanting to convert

DD/MM/YYYY to MM/DD/YYYY?
0
 

Author Comment

by:libertyforall2
ID: 36476483
sorry meant 02/03/2011 to 02-03-2011 mm/dd/yyyy to mm-dd-yyyy
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 36476490

perl -i -pe 's#(\d\d)/(\d\d)/(\d{4})#$1-$2-$3#g' file

Open in new window

0
 

Author Comment

by:libertyforall2
ID: 36476498
Is this for unix/linux? and how would I do it for all FILES in a directory ? *txt ?
0
 

Author Closing Comment

by:libertyforall2
ID: 36476502
Works great!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Six Sigma Control Plans
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

627 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