Using Sed to perform multiple substitutions?

Hello

I have the following output which is returned with the Month in text format instead of numerical. The output I receive is performed by using Rational Synergy CM software commands from the Unix command line and piping Unix commands on the end.

 
bash-3.00$ ccm query -n cmsynergy_menu.sh -f "%displayname %create_time" | nawk -F" " '{print $7 $4 $5 $6}' | sed 's/://g'

2008May12114734
2008May12115152
2008Aug19114242
2008Dec05110053
2008Dec05115352
2009Jun01141322
2009Jun03143124
2009Jun03144401
2009Dec03170001
2009Dec03172339
2010Jan22121924
2008Jun03122912
2010Feb12143618
bash-3.00$

I need to convert month values to numeric format. E.g. May to appear as 05, Aug to appear as 08 etc.

Is there any way of doing this without needing a seperate sed pipe for each month value I need to change to numerical format?

Many thanks
Glyn

If the case of month is not changing then try this. Add substitution for remaining months

sed "s/Jan/01/;s/Feb/02/;s/Mar/03/"

What does the data look like coming out of the 'ccm query' part of the pipe going into nawk?

Try this, assuming the month is the 4th field of the output of the ccm query:

ccm query -n cmsynergy_menu.sh -f "%displayname %create_time" | 
nawk 'BEGIN {
  a="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"
  split(a,m,",")
  for(i=1;i<13;i++) {n[m]=sprintf("%02d", i)}
}
{
  gsub(":","")
  $4=n[$4]
}
{print $7 $4 $5 $6}'

The data comes out like the following:

 1) cmsynergy_menu.sh-0      Mon May 12 11:47:34 2008
 2) cmsynergy_menu.sh-1      Mon May 12 11:51:52 2008
 3) cmsynergy_menu.sh-10     Tue Aug 19 11:42:42 2008
 4) cmsynergy_menu.sh-11     Mon Aug 25 10:05:40 2008
 5) cmsynergy_menu.sh-12     Tue Aug 26 13:19:37 2008
 6) cmsynergy_menu.sh-13     Tue Sep 02 09:29:06 2008
 7) cmsynergy_menu.sh-14     Thu Sep 25 12:44:12 2008
 8) cmsynergy_menu.sh-15     Mon Sep 29 15:45:54 2008
 9) cmsynergy_menu.sh-16     Thu Oct 02 17:14:59 2008
10) cmsynergy_menu.sh-17     Fri Oct 03 16:45:29 2008
11) cmsynergy_menu.sh-18     Mon Nov 03 16:25:36 2008
12) cmsynergy_menu.sh-19     Tue Nov 11 11:52:03 2008
13) cmsynergy_menu.sh-2      Mon May 19 15:35:02 2008
14) cmsynergy_menu.sh-20     Fri Nov 28 10:24:05 2008
15) cmsynergy_menu.sh-21     Fri Nov 28 16:34:47 2008
16) cmsynergy_menu.sh-22     Tue Dec 02 09:26:13 2008
17) cmsynergy_menu.sh-23     Fri Dec 05 11:00:53 2008
18) cmsynergy_menu.sh-24     Fri Dec 05 11:53:52 2008
19) cmsynergy_menu.sh-25     Mon Jun 01 14:13:22 2009
20) cmsynergy_menu.sh-26     Wed Jun 03 14:31:24 2009
21) cmsynergy_menu.sh-27     Wed Jun 03 14:44:01 2009
22) cmsynergy_menu.sh-27.1.1 Thu Dec 03 17:00:01 2009
23) cmsynergy_menu.sh-28     Thu Dec 03 17:23:39 2009
24) cmsynergy_menu.sh-29     Fri Jan 22 12:19:24 2010
25) cmsynergy_menu.sh-3      Tue Jun 03 12:29:12 2008
26) cmsynergy_menu.sh-30     Fri Feb 12 14:36:18 2010
27) cmsynergy_menu.sh-4      Wed Jun 04 10:43:59 2008
28) cmsynergy_menu.sh-5      Fri Jun 06 09:52:33 2008
29) cmsynergy_menu.sh-6      Mon Jun 16 11:10:34 2008
30) cmsynergy_menu.sh-7      Mon Jul 28 13:49:16 2008
31) cmsynergy_menu.sh-8      Wed Jul 30 16:07:15 2008
32) cmsynergy_menu.sh-9      Wed Aug 13 11:50:44 2008

Anbu33, that's worked fine! Thanks.

Franklin52, I'm going to give that a go as well. Thanks