Re: Substituing groups elements in file names
From: Kenny McCormack (gazelle_at_yin.interaccess.com)
Date: 04/24/05
- Next message: J Krugman: "[zsh]: how to halt autocompletion?"
- Previous message: Chris F.A. Johnson: "Re: Substituing groups elements in file names"
- In reply to: tacoguy: "Substituing groups elements in file names"
- Next in thread: tacoguy: "Re: Substituing groups elements in file names & THANK YOU A LOT!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 24 Apr 2005 19:22:50 GMT
In article <tBzae.6748$3%4.1397821@weber.videotron.net>,
tacoguy <tacoguy@multik.uk> wrote:
>I have a very large number of files named in the format:
>
>1946-March-23, history.jpg
>
>I need them to be named in ANSI format:
>
>1946-03-23, history.jpg
>
>In other words I want to substitute the group (Januray, February...)
>with the group (01,02) within file names.
ls *.jpg | gawk -F- 'BEGIN {q="\"";for (i=1; i<=12; i++)
months[strftime("%B",mktime("2000 "t" 01 01 01 01"))] = t=substr(i+100,2)}
{ print "mv",q $0 q,q gensub($2,months[$2],1) q }' > file
Now bring up "file" in your editor, and, when you are happy with it,
source it from a shell prompt.
- Next message: J Krugman: "[zsh]: how to halt autocompletion?"
- Previous message: Chris F.A. Johnson: "Re: Substituing groups elements in file names"
- In reply to: tacoguy: "Substituing groups elements in file names"
- Next in thread: tacoguy: "Re: Substituing groups elements in file names & THANK YOU A LOT!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|