IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Never mind - figured it out (at last!)
This particularly appalling string of code does the trick (just in case anyone else out there needs to do this kind of thing in future).

It's not at all pretty, but it works.


type OLDCTLFILE.tmu | grep POSITION | sed "s/NULLIF.*//g" | sed "s/[^0-9()]/ /g" | sed "s/ *//g" | sed "s/)(/ /g" | sed "s/[()]//g" | gawk " { printf(\\"s/POSITION(%s)/POSITION(%s:%s)/\\n\\",$1,$1,$1+$2-1);}" > BUNCHOFNIFTYSEDCOMMANDS.ctl


/me does quick "Hooray for me!" dance, wonders why everyone looks at him funny...
John. Busy lad.
New Simpler solution for anyone else.
I assume that most people would have Perl installed, or wouldn't have a requirement not to use it. In which case the following code should work:
perl -pi.bak -e "s/(\\d+)(\\).*?\\()(\\d+)/$1:@{[$1+$3-1]}$2$3/" CTLFILE.tmu

I could have avoided the horrible @{[...]} construct for interpolating the calculation, but not without fighting the fact that the meaning of " was being fought over by both Perl and DOS.

Cheers,
Ben
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New <genuflect> I'm not worthy! :) </genuflect>
That has certainly added much impetus to my thoughts of "really must learn Perl one day". In what has traditionally been a very Windows-centric workplace, it can be difficult to gain acceptance for useful tools :)

I do, of course, have Perl at home, but haven't really had any good reason to learn it.

I think this has ended up taking longer than if I had altered all the files manually. But it's been much more rewarding, less prone to error, I've learnt more about sed awk and regexps, and it's been way beneficial to the whole job satisfaction thing. Hurrah.
John. Busy lad.
New ICLRPD (new thread)
Created as new thread #108807 titled [link|/forums/render/content/show?contentid=108807|ICLRPD]
===

Implicitly condoning stupidity since 2001.
New nice - .tmu?
-drl
New Borrowed the filename from his code sample
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New stands for Table Management Utility
Basically, the bulk loader for the Red Brick database.

I love RedBrick, it's the only database I've met than can consistently give different results for

Select count(*) from table

versus

select count(*) from table where 1=1


John. Busy lad.
New ICLRPD (new thread)
Created as new thread #108981 titled [link|/forums/render/content/show?contentid=108981|ICLRPD]
===

Implicitly condoning stupidity since 2001.
New In case anyone thought that you were joking
There was a discussion on a local Perl list where someone was asking how to connect to Red Brick. I mentioned that this quote was all that I know about it. (Unfortunately I misattributed it - sorry.) The person who was using it tested this and told me that it actually only misbehaved on some of his tables!

Remind me to never take a job that requires using Red Brick. Ever.

Cheers,
Ben
To deny the indirect purchaser, who in this case is the ultimate purchaser, the right to seek relief from unlawful conduct, would essentially remove the word consumer from the Consumer Protection Act
- [link|http://www.techworld.com/opsys/news/index.cfm?NewsID=1246&Page=1&pagePos=20|Nebraska Supreme Court]
Expand Edited by ben_tilly Aug. 11, 2004, 11:11:23 AM EDT
New RedBrick - Database by Schroedinger.
New Aw, c'mon
All that predictability is boring.

I've played with RedBrick. Read-only, no updates, basically a wicked fast query system.
New There is actually a command to fix the problem
The only issues surrounding its use are

a) You have to know when your tables are broken so you can fix them
b) the manual says, in large friendly letters: Before running this command, back up your entire database, and contact your local support representative.

Really gives one the warm fuzzies...

I can't remember the actual command off the top of my head. This is probably just as well. For what it's worth, I did run it, with no (readily apparent) ill effects. Mind you, I did this well and truly after we'd migrated everthing to a real (Oracle) Database...
Remind me to never take a job that requires using Red Brick. Ever
Sound advice. I've already turned down a job offer for that very reason.
Two out of three people wonder where the other one is.
     Sed/awk task (modifying db bulk-load control files) - (Meerkat) - (12)
         Never mind - figured it out (at last!) - (Meerkat) - (11)
             Simpler solution for anyone else. - (ben_tilly) - (10)
                 <genuflect> I'm not worthy! :) </genuflect> - (Meerkat) - (1)
                     ICLRPD (new thread) - (drewk)
                 nice - .tmu? -NT - (deSitter) - (7)
                     Borrowed the filename from his code sample -NT - (ben_tilly) - (6)
                         stands for Table Management Utility - (Meerkat) - (5)
                             ICLRPD (new thread) - (drewk)
                             In case anyone thought that you were joking - (ben_tilly) - (3)
                                 RedBrick - Database by Schroedinger. -NT - (Another Scott)
                                 Aw, c'mon - (broomberg)
                                 There is actually a command to fix the problem - (Meerkat)

Powered by synthetic hairballs!
71 ms