Operating System - Linux
1752497 Members
5444 Online
108788 Solutions
New Discussion юеВ

Re: awk substitution help

 
SOLVED
Go to solution
lawrenzo_1
Super Advisor

Re: awk substitution help

ok thanks James
hello
Hein van den Heuvel
Honored Contributor

Re: awk substitution help

Chris>> Hein this works but there are months from 2006 with the time stamp (oct,nov,dec)

Yes. Duh. What was I thinking?

Ultimately you'll be better of picking up perl, specially for easy jobs to learn, but just to correct my bad advice her it an awk variant:

awk '{filename=$9; month=$7; year=$8; if (year ~ /:/){year = (month ~ /Sep|Oct|Nov|Dec/)? 2006 : 2007} print filename,month,year}' orig

In slow motion...

awk '{
filename=$9;
month=$7;
year=$8;
if (year ~ /:/){
year = (month ~ /Sep|Oct|Nov|Dec/)? 2006 : 2007
}
print filename,month,year
}' orig

Hein
lawrenzo_1
Super Advisor

Re: awk substitution help

great stuff thanks all!

Chris.
hello
lawrenzo_1
Super Advisor

Re: awk substitution help

;)
hello