Sublime text replace all lines first number in sequential order - sublimetext3

Modding for a game, and the first number in each line needs to be sequential order, had to delete some so there no longer in sequential order, How does one replace the numbers back in sequential order.

Related

Replace specific characters in a paragraph of text based on its numbered position with randomly generated characters

I've dabbled a bit with JavaScript years ago but I couldn't quite grasp the logic behind it. I still have some understanding of the basics but not enough to achieve what I'd like to. I don't have the time to research how to write the code myself, but if you could point me to already-coded, individual functions which achieve the results I'm looking for, perhaps I could play around with them and then ask for further help after that when needed.
I've got a paragraph of text (It could be anything) about 300 characters long, including spaces, capitalization, and punctuation. I would like a function which generates a random number based on the length of characters in the paragraph, i.e. the function counts the number of characters such that the generated number would never be higher than the number of characters in the paragraph) and then replaces that character with a randomly generated character based on a list of characters which appear in the paragraph (e.g. a-z,A-Z,and punctuation).
For example, if the number generated is 34, then the 34th character (whatever it may be) will be replaced by whatever character is randomly generated.
And finally, a function to input how many times this process should repeat, e.g. 10 times, 100 times, etc. before stopping, and one can view how the resulting paragraph of text has changed.
Any suggestions will be appreciated. Thanks.
Sorry, I've not tried anything yet as I'd like to get advice, first.

How can I check how long a line is in python?

The plan is for the user to paste a huge list, that will be divided in a lot of lines, The huge variable will be recorded as "raw_text", I want to take out the first line, which will be saved as "line_to_convert", analyse that one and then start again, but for that I need to know how long a line is
Does len(raw_text.split()[0]) work for you?
In general, what you need is str.split().
str.split(sep=None, maxsplit=- 1)
Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified or -1, then there is no limit on the number of splits (all possible splits are made).

Deterministic finite Automata design

Can anybody refer me to algorithm for this?
A simulation of a DFSM: Design and implement a program to simulate a DFSM. This program must take two arguments and output ‘yes/no’. The first argument is a file name (the name of a file containing the specification of a DFSM) and the second argument is a string. Both arguments must be command-line arguments. The output of the program is ‘yes’ if the DFSM accepts the string and ‘no’ otherwise. The DFSM specification, given in a file, is structured as follows:
The first line of the file contains the input alphabet separated by one or more spaces. Each alphabet should be a single character.
The transition function is given as a table. The order of the alphabet listing will be the same as the order of the columns of the transition table.
The last line of the file contains the set of final states separated one or more spaces.
The transition function is given between the first and the last lines of the file.
Each row of the transition table will be a line. Elements of the row are separated one or more spaces. Assuming that there are at least three lines in the file, the second line corresponds to the first row of the transition table indexed by state 1. The row indices are implicit starting from the second line of the file. Columns of the table are indexed by the ordering of the alphabet as it appears in the first line. States are denoted by integers starting from 1, which is the start state.
The rows of the transition table are given between the first and last lines of the file with one row per line.

Is there a quick way for excel to identify and remove duplicate series from a cell such as this?

Is there a built in function, or a simple UDF that can identify the pattern in the information below and remove the duplicates?
Assume the following is all within a single excel cell:
80154, 80299, 80299, 82055, 82145, 82205, 82520, 82570, 83840, 83925,
83925, 83986, 83992, 84315, 80154, 80299, 80299, 82055, 82145, 82205,
82520, 82570, 83840, 83925, 83925, 83986, 83992, 84315
There are two sets of data (starts with 80154 ends with 84315). I want to end up with only one set, but I want to do it to 50,000 lines. The final output should be just the BOLD text. Also, sometimes the data repeats itself 3 times, again, I just want the unique set of data.
NOTE: I can't just remove duplicates, because sometimes there will be duplicates in the set that I need to capture in the final output. For example, (A,A,B,C,A,A,B,C) needs to be reduced to (A,A,B,C).
This finds where the first 20% is repeated and cuts the string at that point.
IF it does not find a duplicate it will return the whole string.
=IFERROR(LEFT(A1,FIND(LEFT(A1,LEN(A1)/5),A1,2)-3),A1)
Play with the 5 till you find the proper length of string that will get you the correct answer on all your strings. The higher the number the smaller the string it compares.
Also if it is cutting off too much or not enough, like leaving the , at the end adjust the -3 up and down.

Join groups of N lines

I have a text file generated from an old database that consists of one line per field, with no delimiter between records other than knowing how many fields there are. What I'd like to do is join the first N lines, and then the next N, and so on. Is there any way to do this within Vim? Is there were a way to select lines to apply a command to based on an arbitrary VimL expression (like line(".")%5==0) instead of just a regex?
There are multiple ways of solving this. First that comes to my mind is recording a macro, say in register w:
qw5Jjq
This essentially uses the J normal command to join 5 lines and moves one down. Then you can repeat the macro for 20 times with a simple 20#w or keep repeating afterwards with ##.
Another, maybe more "proper" way is using the :join ex command, which is the same as the J normal command, but can be abbreviated to :j and used in conjunction with the :g to operate in various lines. For example:
:g/./j5
This will match every line non-empty line and in each one of them, join the next 5 lines (inclusive). Then move to the next line and join more 5 and so on.

Resources