Grep number words above 10 programmatically [closed] - grep

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written a long thesis (in latex) and need to change all numbers above 10 from written words to numerals (eg thirteen to 13, twenty to 20).
The bsd-games package contains the programme numbers, which turns numerals into digits eg:
>number -l 1234
one thousand two hundred thirty-four
and I can get a sequence of numbers from say 10:1000 using seq:
>seq 10 1000
Now all I need to do is grep all my latex files (*.tex) for the number words (above 10), so I know where to find the offending number-words, without having to read through the whole thesis!
So to be clear what I'm asking: grep a text file to find all written number words between 10 and 1000.

You don't need to use number. A "number in words" greater that 9 is going to contain at least one of "ten", "eleven", ... "nineteen", "twenty", "ninety", "hundred", "thousand", "million", "billion" and ... stop when it gets too silly. That is only twenty something words. You can easily enter them by hand on the grep command line.

Related

Telephone mask (number format) with variable lenght [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I was looking for the best solution to mask cells with telephone numbers like the example:
(+55 11) 99999-9999
Normally I'd use (+## ##) #####-#### as a custom number format. The problem is that the length of the number may vary. Nine numbers for cellphones and eight for home numbers. So, with a mask like that, an eight number phone would be formated like (+5 51) 19999-9999
Well, while posting this question I found the solution I wanted using Custom Number Format with conditions based on the number value.
[<=999999999999](+00 00) 0000-0000; [>999999999999](+00 00) 00000-0000;

Why do we check if empty before we move? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I see a lot of codes like this:
if WA > SPACES
move WA to WA2
end-if
What are the advantages that this is checked? Is it more efficient to check if it is empty than to just move it anyways?
Additional information:
WA and WA2 can be simple structures (without fillers) but also just simple attributes. They are not redifined and typed as chars or structures of chars. They can be either low-values (semantically NULL) or have alphanumeric content.
Nobody can tell you what the actual reason is except for the people who coded it, but here is a very probable reason:
Usually this is accompanied with an ELSE that would cover what happens if the value is less than spaces, but in this case I would assume that what every happens to this data later is relying on that field NOT being LOW-VALUES or some funky non-displayable control character.
If I had to guess, I would assume that WA2 is initialized to spaces. So doing this check before the move ensures that nothing lower than spaces would be moved to that variable. Remember, less than spaces does not mean empty, it just means that hex values of that string are less than X'40' (so for example is the string was full of low values, it would be all X'00'. So I would guess that its more about ensuring that the data is valid than efficiency.

Regular Expression in MVC5 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
What would a Regular Expression need to allow characters and numbers only, no special characters or spacing in asp.net mvc5?
You generally use ranges such as [a-z] and [0-9] to filter out just characters and numbers with an asterisk after it *
I don't have a copy of MVC 5 handy so I don't know what the particular syntax is.
A regex for that often looks like:
([0-9]|[A-Z]|[a-z])*
It will be very similar in asp.net or mvc, likely.
That searches for all alphabetic characters from a to z, and all numbers from 0 to 9. The asterisk makes it search for multiple characters and not just a single character at a time. The pipe character says "or". Search for characters upper case, or characters lower case, or numbers. The brackets help sort groups.
As I said though you will have to figure it out the specific syntax of your regex library that your programming language uses, as they can differ. There are perl style regexes, and many variations. The above is just a sample. You can test at:
http://regexstorm.net/tester

How to find the n most frequent words in a PDF file on Ubuntu? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have various research papers (nearly 150) which are PDF files. I have to find the n most frequent words in these files.
These PDF files have figures and mathematical formulas also. I know how to do it for a single text file with only words. I want to write a script which parses all 150 PDF files and then returns list of n most frequent words in these files.
I want a method to parse complicated PDF files (with words,figures and formulas)
Then I want to write a script which parses all files in the specific location on my PC and return a list of n most frequent words in all the PDF files combined.
1) parse PDF files with CAM::PDF
2) use split() in perl like (spaces or tabs) this (for each pdf and each lines inside) to get every words :
$words{$_}++ for split /\s+/, $line;
3) at the end, sort (or iter and test each values) by numerical values of %words and get the 1th element

Google Docs: Extract numbers from cell, then sum them and display in another cell [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How can I write a formula for column B that will find numbers in A, then sum and display them in B?
Here's the example:
A B
Milan 2I + Marko 3I 5 what happened: 2+3=5, display 5
Nevena 6I + Umic 4I 10 what happened: 6+4=10, display 10
Things I've tried:
left, right, mid - can't work because names are random;
some formulas which only give me the first number, without the second;
writing a UDF in C but failed to convert it to javascript code;
tried converting letters into 0s, then summing all the numbers in
that one cell.
Things I've thought of but don't know how to pull off:
writing a formula that finds numbers that are followed by "I".
Note: The only constant thing in the cells is the fact that each number is followed by "I"
This should work for finding the two numerical values, however it is a bit convoluted and I'm sure it can be abstracted to a few cells to make it easier and more efficient. Assume A1 is the cell of your string.
=SUM(VALUE(MID(A1,FIND(REGEXEXTRACT(A1,"[0-9]I"),A1),LEN(REGEXEXTRACT(A1,"[0-9]I"))-1)),VALUE(MID(A1,FIND(REGEXEXTRACT(REGEXREPLACE(A1,CONCATENATE("^.{",FIND(REGEXEXTRACT(A1,"[0-9]I"),A1)-1,"}[0-9]I",""),""),"[0-9]I"),A1),LEN(REGEXEXTRACT(REGEXREPLACE(A1,CONCATENATE("^.{",FIND(REGEXEXTRACT(A1,"[0-9]I"),A1)-1,"}[0-9]I"),""),"[0-9]I"))-1)))

Resources