Need Advice

Joined
Dec 9, 2022
Messages
6
Reaction score
0
I get a weekly text file that contains hundreds of similar records. I use MS Word to scan through the file deleting about half and editing the others. The editing is mainly deleting whitespace and some reformatting to make the information easier to read. No information is added. This takes about 3 hours; very tedious.

I would like to write a program to automate this process. I have some programming experience with C and Basic, and Unix tools. I work on an iMac desktop computer. I am looking for recommendations on the best and easiest programming language to use. This is a one-time project so I want to minimize the effort needed to get this done.

Thank you.
 
Joined
Jul 12, 2020
Messages
89
Reaction score
9
Why would it contain hundreds of similar records?
What format should it end up in?
Takes you three hours, would take javascript less than a second depending on what you're actually doing with it.
 
Joined
Dec 9, 2022
Messages
6
Reaction score
0
This is a Police Log where each record is an incident report such as a traffic stop. All incidents have the same structure and format while the content is different. The source is a text file and the result is a text file. I need to be able to isolate an incident, check its content to see if I want to keep it, and then reformat the keepers. Are you suggesting javascript is the best choice for this project?
 
Joined
Jul 12, 2020
Messages
89
Reaction score
9
I'm not suggesting it's the best choice, however it could be an option. What do you mean when you say it's a one-time project, but you get a weekly text file containing records?

The project is data manipulation (database). The code you would use depends on the system using the police logs. My guess is it would have to be extremely secure so I don't understand why you would be getting a text file with the information.
 
Joined
Dec 9, 2022
Messages
6
Reaction score
0
What I meant by a one-time project is that I may never write another program. I'm not a programmer and don't intend to be one so I'm looking for the easiest solution.

The Police Log is provided by the Police Department once a week to the general public as a plain text file. It is redacted so there is no confidential information in it. The file content is readable but needs work. I extract the interesting incidents from the log, edit them to be more concise and readable and publish the log in a newspaper.
 
Joined
Dec 9, 2022
Messages
6
Reaction score
0
I have a text file with 240 records separated by "zz". I want to split the file into an array so that each record is in an array slot. Here is the code I am experimenting with.

#!/usr/bin/env perl
use strict;
use warnings;

open(my $configfile, "<", 'PoliceLog.txt') or die "$!";

my @configdata = split('zz',<$configfile>);
print "$configdata[0]\n";
print "$configdata[1]\n";
print "$configdata[2]\n";

close $configfile;

The print "$configdata[0]\n"; command prints the first record correctly. The 2nd and 3rd print commands do not print a record and cause the following error reports.

Use of uninitialized value $configdata[1] in concatenation (.) or string at TestC.pl line 10, <$configfile> line 1.
Use of uninitialized value $configdata[2] in concatenation (.) or string at TestC.pl line 11, <$configfile> line 1.

Any help is appreciated.
 
Joined
Dec 21, 2022
Messages
28
Reaction score
4
I have a text file with 240 records separated by "zz". I want to split the file into an array so that each record is in an array slot. Here is the code I am experimenting with.


Use of uninitialized value $configdata[1] in concatenation (.) or string at TestC.pl line 10, <$configfile> line 1.
Use of uninitialized value $configdata[2] in concatenation (.) or string at TestC.pl line 11, <$configfile> line 1.

Any help is appreciated.
Uhh, I am really not into Perl. (Isn't it a dead language these days?)

I would recommend to change to Python if you want use a script language.

The error messages are a hint that the array has only one element.
If I have to guess:
Either the data was not loaded correctly, you used the split function wrong, or there are no 'zz' found.
 
Joined
Jul 12, 2020
Messages
89
Reaction score
9
There may be a slight problem with that Bob, you say that your text file uses a zz delimiter to separate the entries. What do the individual entries use to separate each portion of the individual entry? What all do you want the script to do?
 
Joined
Jan 2, 2023
Messages
1
Reaction score
0
If you're interested in the world of programming and entrepreneurship, you won't want to miss this video about Sam Altman!

As the former President of Y Combinator and current CEO of OpenAI, Altman has made a huge impact in the tech industry. In this video, you'll get an inside look at Altman's journey and hear his insights on a range of topics, including the future of AI, his leadership style, and advice for aspiring entrepreneurs. Whether you're a seasoned programmer or just getting started, this is a must-watch for anyone looking to learn from one of the best in the field. Click on the link to check it out now!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top