Sponsored Content
Top Forums Shell Programming and Scripting Number count per number ranges Post 302151951 by shirleyeow on Tuesday 18th of December 2007 03:37:14 AM
Old 12-18-2007
Number count per number ranges

Hi,

I have a question here that need to get advise from all of you. Let say I have a set of data

12347777
12359899
12347677
12360090
12347688
12359979
12359009
12367022
12346677

I need to count the number that appear in each numbering ranges and the output is like below:

Prefix Count
1234 4
1235 3
1236 2

How can I do this by using shell script? What command that I can use? Please advise. Really appreaciate your help. Thank you so much.

Best Regards,
Shirley
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding number ranges using grep

Is it possible for me to find numbers in a file by a range using grep? like cat data | cut -f1 | grep <info> Im trying to find information and extract every amount that is less than a number (ie less than 75 or whatever) Is this possible? (2 Replies)
Discussion started by: DKNUCKLES
2 Replies

2. Shell Programming and Scripting

File number count

hi all i want to count the number of files in a particlar dir i have wrote the codes as below fileCount= ls | wc -l if then echo " " elif then echo " " fi however when i excute the program there are error happens " unary operator expected" i just woundering fileCount=... (4 Replies)
Discussion started by: cryogen
4 Replies

3. Shell Programming and Scripting

count the number of lines that start with the number

I have a file with contents similar to this. abcd 1234 4567 7666 jdjdjd 89289 9382 92 jksdj 9823 298 I want to write a shell script which count the number of lines that start with the number (disregard the lines starting with alphabets) (1 Reply)
Discussion started by: grajp002
1 Replies

4. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

5. Shell Programming and Scripting

Print numbers between two number ranges

Hi, I have a list.txt file with number ranges and want to print/save new all.txt file with all the numbers and between the numbers. == list.txt == 65936 65938 65942 && 65943 65945 ... (7 Replies)
Discussion started by: AK47
7 Replies

6. Shell Programming and Scripting

How to convert multiple number ranges into sequence?

Looking for a simple way to convert ranges to a numerical sequence that would assign the original value of the range to the individual numbers that are on the range. Thank you given data 13196-13199 0 13200 4 13201 10 13202-13207 3 13208-13210 7 desired... (3 Replies)
Discussion started by: jcue25
3 Replies

7. Shell Programming and Scripting

How to count number of files in directory and write to new file with number of files and their name?

Hi! I just want to count number of files in a directory, and write to new text file, with number of files and their name output should look like this,, assume that below one is a new file created by script Number of files in directory = 25 1. a.txt 2. abc.txt 3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies

8. Shell Programming and Scripting

How to count the number of strings?

Hi, I have a text file as shown below. I would like to count the unique number of connections of each person in the first and second column. Third column is the ID numbers of first column persons and fourth column is the ID numbers of second column persons. susan ali 156 294... (7 Replies)
Discussion started by: mohamad
7 Replies

9. Shell Programming and Scripting

How count number of char?

hello how can i cont number of char with loop coomand? i dont want to use wc or other special command the script should check all word's char. one by one also a counter can handle the number As noted in other threads started today. This is not the correct forum for homework assignments. ... (2 Replies)
Discussion started by: nimafire
2 Replies

10. Shell Programming and Scripting

Print root number between min and max ranges

Hi to all, Please help on the following problem, I'm not where to begin, if awk or shell script. I have pairs of ranges of numbers and I need to find the root or roots of ranges based on min Range and Max ranges Example #1: If min range is 120000 and max ranges 124999, it means that are... (5 Replies)
Discussion started by: Ophiuchus
5 Replies
DVISELECT(1)						      General Commands Manual						      DVISELECT(1)

NAME
dviselect - extract pages from DVI files SYNOPSIS
dviselect [ -s ] [ -i infile ] [ -o outfile ] list of pages [ infile [ outfile ] ] DESCRIPTION
Dviselect selects pages from a DVI file produced by TeX, creating a new DVI file usable by any of the TeX conversion programs, or even by dviselect itself. A range is a string of the form even, odd, or first:last where both first and last are optional numeric strings, with negative numbers indicated by a leading underscore character ``_''. If both first and last are omitted, the colon may also be omitted, or may be replaced with an asterisk ``*''. A page range is a list of ranges separated by periods. A list of pages is described by a set of page ranges sepa- rated by commas and/or white space. Dviselect actually looks at the ten count variables that TeX writes; the first of these (count0) is the page number, with count1 through count9 having varied uses depending on which macro packages are in use. (Typically count1 might be a chapter or section number.) A page is included in dviselect's output if all its count values match any one of the ranges listed on the command line. For example, the com- mand ``dviselect *.1,35:'' might select everything in chapter 1, as well as pages 35 and up. ``dviselect 10:30'' would select pages 10 through 30 (inclusive). ``:43'' means everything up to and including page 43 (including negative-numbered pages). To get all even-num- bered pages, use ``even''; to get all odd-numbered pages, use ``odd''. If a Table of Contents has negative page numbers, ``:_1'' will select it. Note that ``*'' must be quoted from the shell; the empty string is more convenient to use, if harder to read. Instead of count values, dviselect can also select by ``absolute page number'', where the first page is page 1, the second page 2, and so forth. Absolute page numbers are indicated by a leading equal sign ``=''. Ranges of absolute pages are also allowed: ``dviselect =3:7'' will extract the third through seventh pages. Dot separators are not legal in absolute ranges, and there are no negative absolute page numbers. Even/odd specifiers, however, are legal; ``dviselect =even'' selects every other page, starting with the second. More precisely, an asterisk or an empty string implies no limit; an equal sign means absolute page number rather than counts; a leading colon means everything up to and including the given page; a trailing colon means everything from the given page on; the word ``even'' means only even values shall be accepted; the word ``odd'' means only odd values shall be accepted; and a period indicates that the next count should be examined. If fewer than 10 ranges are specified, the remaining counts are left unrestricted (that is, ``1:5'' and ``1:5.*'' are equivalent). A single number n is treated as if it were the range n:n. An arbitrary number of page selectors may be given, separated by commas or whitespace; a page is selected if any of the selectors matches its counts or absolute page number. Dviselect normally prints the page numbers of the pages selected; the -s option suppresses this. AUTHOR
Chris Torek, University of Maryland SEE ALSO
dviconcat(1), latex(1), tex(1) MC-TeX User's Guide The TeXbook BUGS
A leading ``-'' ought to be allowed for negative numbers, but it is currently used as a synonym for ``:'', for backwards compatibility. Section or subsection selection will sometimes fail, for the DVI file lists only the count values that were active when the page ended. Clever macro packages can alleviate this by making use of other ``free'' count registers. Chapters normally begin on new pages, and do not suffer from this particular problem. The heuristic that decides which arguments are page selectors and which are file names is often wrong. Using shell redirection or the -i and -o options is safest. Dviselect does not adjust the parameters in the postamble; however, since these values are normally used only to size certain structures in the output conversion programs, and the parameters never need to be adjusted upward, this has not proven to be a problem. DVISELECT(1)
All times are GMT -4. The time now is 01:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy