New user, request for help with text manipulation in Bruji's BookPedia

That’s what I feared :wink: So, glad to hear it’s not (yet) what you’re doing…

1 Like

I tend to agree :wink:

1 Like

I was expecting you to reply "more like 90%". Half of my posts are designed to manipulate people into responding with certain responses. But you didn't bite on this setup. My setup skills are failing me.

1 Like

Sometimes I'm polite and diplomatic…

1 Like

The thing with the CSV is that is not completely trivial to split an optionally colon-separated entry in the first column, and send the second part to the second column. And getting rid of spaces. Bit doable, of course.

Since you told me you didn’t download the app, here an example CSV dump (only 3 records) to play with (if you want):

Library.csv.zip (900 Bytes)

Edit:

Or here as tab-delimited one, if you prefer: Library (tab).txt.zip (870 Bytes)

1 Like

I just caught your "yet" joke. Nice one. Big smile. I think the chance I'll ever build Skynet is under 1%. To be honest, I don't think any software that I've ever written has ever "learned" anything. I still have no idea what "learning" is. I can't even define it. But once I can define it, watch out. Five minutes after I understand what leaning is, Skynet will be born.

2 Likes

If the second column is always blank (a pair of empty quotes), I think it probably is nearly trivial. It's just a matter of moving the quotes. I could be wrong, but it feels quite trivial.

It always takes me an hour to get these things working.

1 Like

Didn’t even remember that that Skynet was learning. Time to watch that Terminator stuff again. Maybe. When was this? 1985 or so?

1 Like

Thanks, Tom - Yes, I could export all the data and manipulate it that way and then re-import it.

Or presumably use SQL on the table in question.

But I like the idea of getting KM to do what it's best at in situ :slight_smile:

If I understood the OP’s OP right, the second column (“Original Title”) is always blank. @MarkSealey ?

Don’t forget that the first column doesn’t always contains colons and that other columns may contain colons (which should be left untouched).

Maybe an actual (real world) database dump would be helpful, @MarkSealey… CSV or/and tab delimited.

1 Like

I think the plot was specifically about Skynet's "learning" ability, within seconds of some General flipping the switch enabling it. I can't remember if that was more clear the original or the sequel, called T2: Judgment Day.

I think it's worth rewatching the movie to see what they say about "learning" software. That was fairly cutting edge terminology for the 1980s. And about ten years later the realism blew a fuse with The Matrix, which was about using humans as an "energy source". We're a sink not a source! Those creators of Matrix have no science background and shouldn't be talking about science at all. If aliens do come to earth the thing they're most likely to steal from us is our artwork and libraries. They certainly don't need our energy or our planet.

I said it would take me 5 minutes to program Skynet after I learn how to learn, but in the movie it was closer to 5 seconds. I think they explained that it became sentient with a few seconds and decided to eliminate humanity at that moment. This plot absolutely scares Elon Musk to death, but I think it's vastly overstated.

1 Like

I'm proud of you! Go for it. Indeed, it might be best in this case because you said you WANTED to validate each change.

1 Like

If you are good with SQL, then this should be the way to go, no? No need to force KM into domains that are easier solved by the proper ways.
But, as @Sleepy has proposed, manipulating a CSV export would be a good solution, too. Always better than tinkering around with GUI stuff (pressing buttons, selecting menus, etc.)

1 Like

Tom,

Yes, the second column/field is always blank to begin with.

Whether it actually has a null (ASCII 0) in it I'm not so sure. Doubt it.

In any case with the process I'm trying to automate it's always safe to paste the after-the-colon-maybe-with-space(s) string into that field regardless.

I'm also quite happy to do this record by record a) to keep an eye on things; b) because some colons are to be retained and c) because some Titles have more than one colon.

Your points are valid. I don't think I'm worried about your first point, but the second one does worry me. I might have to use awk instead of sed, then. However Mark said he might enjoy creating the KM macro in this case, so who are we to rob him of that pleasure? This is really a KM forum, not an SQL or AWK or SED or CSV forum.

But I don't see colons in the other columns, so maybe it actually can be done in a truly simple one liner.

1 Like

You're right, Tom, about SQL; and the vendor (at Bruji) is always extremely helpful.

But in this case, using KM serves two purposes - one of which is for me to teach myself (and learn from all of you, thanks!) just what it can and can't do.

Am working my way through the MacSparky videos atm :slight_smile:

Well, then it’s easy:

Set the maxEntries variable in my script to 1 and run the script record by record. Just make sure you order the database in a way that isn’t affected by the changes.

Edit:

Nope, sorry, above I said nonsense. You have to order the records in a way that a not yet changed record is on top. (So, maybe reverse changed time, or whatever criteria you have at your disposal.)

1 Like

Time for me to experiment with that script, thanks, Tom.

And high time I thanked you for it.

As I said before - what a terrific forum this is.

Discourse has told me that - as a new poster - I've now reached the maximum number of posts I'm allowed for one day:-(

So I have to add this here:

Sleepy - Yes, I always work from backups; thanks… would it surprise you to know that in addition to TM I actually rotate SuperDuper clones across no fewer than 11 (that's right eleven) external backup drives?

Tom - point taken about understanding where KM fits in to all other (such) utilities. I have played with awk, sed and a lot with Perl. I'd actually have no difficulty massaging those strings with those - after a bit of de-rusting :slight_smile:

I'm committed to familiarising myself with KM and thereby making sure I use it only in the most appropriate ways.

I've also experimented with Automator and have Alfred installed.

I advise you to make an export of your library in case you mess things up. You aren't likely to mess things up, but it seems prudent at this juncture to have a backup.

1 Like

KM might appear as a all-in-one tool. And if you force it, you will likely succeed. Somehow. But in reality KM is probably “only” the closest to an all-in-one tool I’ve seen on the Mac. There are many situations where you’re better off with some other tools, for example CSV files -> Awk, Perl; SQL -> SQL; if an app has an AppleScript dictionary -> AppleScript, etc.

The great thing with KM is that you can combine all those other tools into a KM macro, if you like (in form of scripts, and even combine them with KM actions inside the macro). And that KM provides a wide choice of triggers for those macros then.

1 Like