Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • So I have made a few changes and am now trying to integrate this into a script ready for cron but am getting errors when I execute the below (* is file date/timestamp which I wish to keep): 'for fn in filename*.csv; do newfn="${fn/#filename/newfilename}” [-e "$newfn"] || perl -MPOSIX -pe 's{^(\d{1,2})/(\d{1,2})/(\d{4})}{$t = mktime(0, 12, 0, $2, $1 - 1, $3 - 1900); @t = localtime $t; $t -= 86400 * ($t[6] <= 1 ? $t[6] + 2 : 1); strftime("%m/%d/%Y", localtime $t)}e' $fn > $newfn done' Commented Mar 4, 2014 at 17:13
  • @user61818, newfn=newfilename${fn#filename} and use #! /usr/xpg4/bin/sh, not /bin/sh if Solaris 10 or before. Commented Mar 4, 2014 at 17:44