Sponsored Content
Top Forums Shell Programming and Scripting Shell script to check lotto ticket file for winners Post 302432590 by mabman on Friday 25th of June 2010 12:03:25 PM
Old 06-25-2010
Shell script to check lotto ticket file for winners

OK, so I've got some time on my hands due to a workplace injury, but due to a couple of broken bones and the good drugs, actually implementing something useful is proving challenging Smilie

I am playing with generating large numbers of Pick 6 lottery ticket combos. These are stored in tab-delimited text files, 1 ticket per line. For my purposes I'm looking at large numbers of combos - 10,000 or greater per file.

Somehow I need to check these ticket combo files for winning numbers (either prompted for, or read from another file) - specifically, 2/6 + bonus, 3/6, 4/6, 5/6, 5/6 + bonus, and 6/6. I need the total number of each per file. Flagging which line number of each would be useful as well.

Years ago I had knocked together a Perl script to do this, but that was several hard drives ago, and I have no idea if it still exists somewhere, and I haven't looked at the problem since.

So, I was thinking a shell script using grep and/or awk might work, but I have no idea how to get either utility to count individual numbers per line and add them up.

I have cygwin installed on Windows 7, so presumably BASH and the standard utilities should work.

I did search around, but found nothing relevant.

Thanks for all help (code samples appreciated).
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File System Check using shell script !!!

Hi Guys I m posing this new thread as I didnt get satisfactory result after running search here. My requirement is very simple (using shell script) I need to findout what all file systems are mounted -> Then I need check the health of that file system - by disk usage & by doing a simple... (8 Replies)
Discussion started by: csaha
8 Replies

2. Shell Programming and Scripting

need to check the file using ftp in a shell script

i need to write a shell script.. connecting to another server using ftp and check whether the file ter.txt is exists there or not. i have written scirpt partially,as i new to Unix. ftp -inv $FTPHOST > $TEMPFILE1 2> $TEMPFILE1 << EOF user $FTPUSER $FTPPW binary prompt ${CD} ls *.txt... (11 Replies)
Discussion started by: KiranKumarKarre
11 Replies

3. Shell Programming and Scripting

Need to check for empty file in C shell script

I am running a C shell script. I have an output file from a previous step and I need to run "something" in the next step to check if the file is empty. If the file is empty, then the job script should finish EOJ. If the file is not empty then the job script should abend. Please help Thanks. (4 Replies)
Discussion started by: jclanc8
4 Replies

4. Shell Programming and Scripting

How to check file name format using shell script?

Hi, I am writting a script, which accepts input file as parameter. Input file name is aa_bb_cc_dd_ee.<ext> I need to check that input file name should be of 5 fileds. Please help me out. :confused: (7 Replies)
Discussion started by: Poonamol
7 Replies

5. Shell Programming and Scripting

Shell script to read file and check file type

Hi, I have a file with few values in it. I need script help to read file line by line and check: 1/if it's a file (with extension eg .java .css .jar etc ) or 2/if it's a file without extension and treat it as a directory and then check if the directory exists in working copy else create one... (6 Replies)
Discussion started by: iaav
6 Replies

6. Shell Programming and Scripting

How to check the duplicancy of file using shell script?

Hi all, i am getting the file through sftp from a location in the name of 20141201_file.txt (iam getting the file on daily basis with date appended at the beginning) so before going to my actual process ,i want to check whether today files and yesterday file are same or not(which i used to... (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

7. UNIX for Dummies Questions & Answers

Need shell script to check file

Hi Experts, I am not good in writing script. Just stared.I am looking for shell script to check following parameters. 1) Number of files on remote Linux SUSE server.- Any directory and sub directory. 2) I should define number of files in script. Files should be variable. 3) Age of... (2 Replies)
Discussion started by: ApmPerfMonitor
2 Replies

8. Shell Programming and Scripting

To check whether the file is empty or not in shell script (sh)

Hi All, I need to check a file whether it exists and also whether it is empty or not. I have a code for this but it is not working as per my requirement. Can anyone pls suggest me on this. function funcFLSanityCheck { if then echo "${varFLSentFileListPath}/${varFLSentFileName}... (7 Replies)
Discussion started by: Arun1992
7 Replies

9. UNIX for Beginners Questions & Answers

Shell Script to check a file

I'm required to write a simple shell script that when it runs it writes the output which is a simple barcode to a tmp flat file which I can do the bit I'm struggling with... The next time it runs I need to check the tmp output file to see if that barcode is in the output file and if it is send... (5 Replies)
Discussion started by: worky
5 Replies
ti(1)							      General Commands Manual							     ti(1)

NAME
ti -- issue tracking system built on Git SYNOPSIS
ti COMMAND [ARGUMENTS] DESCRIPTION
ti, short for ticgit, is an issue tracker based on the Git revision control system. It allows you to store bugs in your project in a sepa- rate ticgit or ticgit-ng branch of its development repository, thereby keeping open issues close to the source without cluttering the tree. Every ticket consists of the following information: Title A short summary of the problem. This can be compared to the subject of an e-mail or to the first line of a Git commit message. Ticket ID The Ticket ID (TicId) is the SHA-1 hash of the file which holds the ticket name (which is a normalized form of the title includ- ing the time of ticket creation and a small random number). It is used to uniquely identify a ticket. Number Apart from TicIds, tickets can also be referred to by using their number. This will often be preferred to TicIds when using ticgit from the command line (i.e., in everyday work), but ticket numbers are not persistent (they change with every ti list invocation). In the current version of ticgit, ti list does not show numbers any more, but they can still be used (by counting manually). State A ticket can either be open, resolved, invalid or put on hold. Assignment The e-mail address of the person working on the ticket. Tag A custom label which tells more about the nature of a ticket. A typical example is feature (not a bug, but a feature sugges- tion). ticgit associates no special semantics to tags, you are free to choose them however you like. Tickets can have an arbitrary number of tags. Points You can use this integer value to assign some numerical value, such as a measure for the importance, to each ticket. Again, ticgit does not dictate how to use this field. Comments Comments provide a simple form of communication between bug reporters and developers. COMMANDS
ti supports the following commands: list List tickets. By default, only open issues are shown; to show tickets in other states, use -s STATE. You can also select by tag (-t TAG) or by assignment (-a ADDRESS). When running list, small integer numbers will be assigned to all shown tickets; you may use them to refer to tickets in other commands until you call list again. state Pass a ticket ID and a state specification to set the ticket's state information. You can omit the ticket ID to work on the cur- rent ticket. show Show everything known about the specified ticket. You can omit the ticket ID to show the current ticket. new Create a new ticket. This will launch an editor to let you enter a title, more detailled information about the issue, and some tags. Initially, the ticket will be in the open state. checkout Set the current ticket. comment Add a comment to the ticket specified on the command line. If you do not pass one, the current ticket will be used. tag Pass a ticket ID and a tag name to add a label to an issue. You can omit the ticket ID to tag the current ticket. If you use the -d option, the tag will be removed instead of added. assign Assign the specified ticket to you (or to the given user, when -u ADDRESS is given). If you omit the ticket ID, the current ticket will be assigned. Otherwise, you can prepend -c to the ticket ID to perform the checkout operation after assigning the ticket. points Pass a ticket ID and some integer to assign a point value to the given ticket. If you only pass a number, this command manipu- lates the current ticket. sync Synchronize tickets with the remote repository specified on the command line. This uses the underlying push and pull command implemented in Git, so you can use your usual named remotes. The default remote is origin. recent Get a human-readable changelog of the tickets maintained by ticgit. This command takes its information straight from the commit messages of the ticgit(-ng) branch. These commands show usage information about themselves when passed the --help option. FILES
~/.ticgit/, ~/.ticgit-ng/ The ticket cache. AUTHOR
ticgit is Copyright (C) 2008 Scott Chacon <schacon@gmail.com>. ticgit-ng is Copyright (C) 2011 Jeff Welling <jeff.welling@gmail.com>. This manual page was written by Michael Schutte for the Debian GNU/Linux system (but may be used by others). ti(1)
All times are GMT -4. The time now is 08:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy