Is it possible to manipulate date?

Help with writing and playing macros

Is it possible to manipulate date?

Postby hopper » Tue Jan 04, 2005 1:11 pm

I am formatting raw data and I need to add a date (yesterday) to each line. Is this possible?

Thanks
Hopper
User avatar
hopper
Newbie
 
Posts: 2
Joined: Thu Dec 16, 2004 12:00 am

Re: Is it possible to manipulate date?

Postby Mofi » Thu Jan 06, 2005 10:08 am

In principle - yes. Give us more details about what you really want and how it should work.

Do you need only once a specific date at each line or do you need a macro which adds the date of yesterday every day to each line of a file?

The second one would be very hard to decode with UltraEdit's macro language. So a compiled program would be better for this.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Is it possible to manipulate date?

Postby hopper » Thu Jan 06, 2005 11:52 am

Hi Mofi!

Thanks for the reply!

Here is what I have. I got an exported text file for every day.

uni_010105.txt
uni_010205.txt
uni_010305.txt
uni_010405.txt
uni_010505.txt
etc.

There is no date in the text file.

I currently run a macro that formats the text and publishes it to the web. Originally, I was just inserting yesterday into the file, but now that there are multiple files, I need to identify the data set by date. And merge the files all into one file.

Original Post (http://www.ultraedit.com/index.php?name ... opic&t=474)

I have a macro that formats an exported text file into:

.88,$0.00,,,,WEST,REG,17131,010517,
9.13,$0.00,,,2003,WEST,REG,00000,210056,
3.15,$0.00,1,,2006,WEST,OT,17131,010517,
8.00,$0.00,1,,2006,WEST,REG,17131,010517,
1.25,$0.00,1,,2006,,OT,17131,010517,

My goal is to end up with a recap file that contains all files and dates.

.88,$0.00,,,,WEST,REG,17131,010517,01/01/05,
9.13,$0.00,,,2003,WEST,REG,00000,210056,01/01/05,
3.15,$0.00,1,,2006,WEST,OT,17131,010517,01/02/05,
8.00,$0.00,1,,2006,WEST,REG,17131,010517,01/03/05,
1.25,$0.00,1,,2006,,OT,17131,010517,01/03/05,

Thanks for any ideas and help.

Hopper
User avatar
hopper
Newbie
 
Posts: 2
Joined: Thu Dec 16, 2004 12:00 am

Re: Is it possible to manipulate date?

Postby Mofi » Mon Jan 10, 2005 4:49 am

Okay, I see, the date is part of the file name. So define a template (template 0) called for example "Filename" with template content [FILE_NAME].

Now when you open for example uni_010105.txt, execute following macro commands to insert the name of the file into the file and reformat it to the date string you want, copy the date string to the clipboard and paste it later where you want it. Redo it for every file.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
Template 0
Top
Find RegExp "uni_^([0-3][0-9]^)^([0-1][0-9]^)^([0-9][0-9]^)"
Replace "^1/^2/^3"
StartSelect
SelectToTop
Cut
EndSelect

Add this to your existing macro. Hope this helps.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros