01-07-2009
How to count the number of occurences of this pattern?
Hi all,
I have a pattern like this in a file:
123 4 56 789
234 5 67 789
121 3 56 789
222 4 65 789
321 6 90 100
478 8 40 789
243 7 80 789
How can I count the number of occurences of '789' (4th column) in this set...?
Thanks for all your help!
K
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I've written a script to count the total size of SAN storage LUNs, and also display the LUN sizes.
From server to server, the LUNs sizes differ.
What I want to do is count the occurances as they occur and change.
These are the LUN sizes:
49.95
49.95
49.95
49.95
49.95
49.95
49.95
49.95... (2 Replies)
Discussion started by: cyber111
2 Replies
2. UNIX for Dummies Questions & Answers
I want to count the number of occurences of say "200" in a file but that file also contains various stuff including dtaes like 2007 or smtg like 200.1 so count i am getting by doing grep -c "word" file is wrong
Please help!!!!! (8 Replies)
Discussion started by: shikhakaul
8 Replies
3. Shell Programming and Scripting
I need to count the number of occurrences of a pattern, say 'key', between each occurrence of a different pattern, say 'lu'.
Here's a portion of the text I'm trying to parse:
lu S1234L_149_m1_vg.6, part-att 1, vdp-att 1 p-reserver IID 0xdb
registrations:
key 4156 4353 0000 0000
... (3 Replies)
Discussion started by: slipstream
3 Replies
4. Shell Programming and Scripting
im trying to count the number of occurences of column 2 value(starting from KKK*) of the below file, file.txt
using the code cat file.txt | awk ' BEGIN { print "Category Counts"} {FS=","} {NR > 2} { cats = cats + 1} END { for(c in cats) { print c, "=", cats} } '
but its returning as
... (6 Replies)
Discussion started by: michaelrozar17
6 Replies
5. Shell Programming and Scripting
We have a log file, the format is similar to this:
08/04/2011 05:03:08 Connection Success
08/04/2011 05:13:18 Connection Success
08/04/2011 05:23:28 Connection Fail
08/04/2011 05:33:38 Connection Success
08/04/2011 06:14:18 Connection Success
08/04/2011 06:24:28 Connection Fail
08/04/2011... (6 Replies)
Discussion started by: clu
6 Replies
6. Shell Programming and Scripting
Hi!
In our current directory there are around 35000 files.
Out of these a few thousands(around 20000) start with, "testfiles9842323879838".
I want to count the number of files that have filenames starting with the above pattern. Please help me with the command i could use.
Thank... (7 Replies)
Discussion started by: atechcorp
7 Replies
7. UNIX for Dummies Questions & Answers
hi,
I have a text..and i need to find a pattern in the text and count to the no of times the pattern occured.
i have used grep command ..but the problem is , it shows the occurrences of the pattern but doesn't count no of times the pattern occuries. (5 Replies)
Discussion started by: nvnni
5 Replies
8. Shell Programming and Scripting
Anyone knows how to use AWK to achieve the following
Sun Feb 12 00:41:01-00:41:59 Success:2 Fail:2
Sun Feb 12 00:42:01-00:42:59 Success:1 Fail:2
Sun Feb 12 01:20:01-01:20:59 Success:1 Fail:2
Mon Feb 13 22:41:01-22:41:59 Success:1 Fail:1
log file:
Success
Success
Fail
Fail
... (9 Replies)
Discussion started by: timmywong
9 Replies
9. Shell Programming and Scripting
Hi Guys,
I have 2 files like below
file1
xx
yy
file2
b
yy
b2
xx
c1
yy
xx
yy
Now I want an idea which can count occurences of text from file1 and file2 so outbout would be kind of (9 Replies)
Discussion started by: prashant2507198
9 Replies
10. Shell Programming and Scripting
I have some files as shown below
GLL ALM 654-656 654 656
SEM LYG 655-657 655 657
SEM LYG 655-657 655 657
ALM LEG 656-658 656 658
ALM LEG 656-658 656 658
ALM LEG 656-658 656 658
LEG LEG 658-660 658 660
LEG LEG 658-660 658 660 The value of GLL is... (5 Replies)
Discussion started by: arch
5 Replies
TBL(1) General Commands Manual TBL(1)
NAME
tbl - format tables for nroff or troff
SYNOPSIS
tbl [ file ... ]
DESCRIPTION
Tbl is a preprocessor for formatting tables for nroff or troff(1). The input files are copied to the standard output, except for segments
of the form
.TS
options ;
format .
data
.T&
format .
data
. . .
.TE
which describe tables and are replaced by troff requests to lay out the tables. If no arguments are given, tbl reads the standard input.
The (optional) options line is terminated by a semicolon and contains one or more of
center center the table; default is left-adjust
expand make table as wide as current line length
box
doublebox
enclose the table in a box or double box
allbox enclose every item in a box
tab(x) use x to separate input items; default is tab
linesize(n)
set rules in n-point type
delim(xy)
recognize x and y as eqn(1) delimiters
Each line, except the last, of the obligatory format describes one row of the table. The last line describes all rows until the next .T&,
where the format changes, or the end of the table at .TE. A format is specified by key letters, one per column, either upper or lower
case:
L
Left justify: the default for columns without format keys.
R
Right justify.
C
Center.
N
Numeric: align at decimal point (inferred for integers) or at
S
Span: extend previous column across this one.
A
Alphabetic: left-aligned within column, widest item centered, indented relative to L rows.
^
Vertical span: continue item from previous row into this row.
-
Draw a horizontal rule in this column.
=
Draw a double horizontal rule in this column.
Key letters may be followed by modifiers, also either case:
| Draw vertical rule between columns.
|| Draw a double vertical rule between columns.
n Gap between column is n ens wide. Default is 3.
Ffont Use specified font. B and I mean FB and FI.
T Begin vertically-spanned item at top row of range; default is vertical centering (with
Pn Use point size n.
Vn Use n-point vertical spacing in text block; signed n means relative change.
W(n) Column width as a troff width specification. Parens are optional if n is a simple integer.
E Equalize the widths of all columns marked E.
Each line of data becomes one row of the table; tabs separate items. Lines beginning with are troff requests. Certain special data items
are recognized:
_
Draw a horizontal rule in this column.
=
Draw a double horizontal rule in this column. A data line consisting of a single or draws the rule across the whole table.
\_
Draw a rule only as wide as the contents of the column.
Rx
Repeat character x across the column.
^
Span the previous item in this column down into this row.
T{
The item is a text block to be separately formatted by troff and placed in the table. The block continues to the next line begin-
ning with T}. The remainder of the data line follows at that point.
When it is used in a pipeline with eqn, the tbl command should be first, to minimize the volume of data passed through pipes.
EXAMPLES
Let <tab> represent a tab (which should be typed as a genuine tab).
.TS
c s s
c c s
c c c
l n n.
Household Population
Town<tab>Households
<tab>Number<tab>Size
Bedminster<tab>789<tab>3.26
Bernards Twp.<tab>3087<tab>3.74
Bernardsville<tab>2018<tab>3.30
.TE
Household Population
Town Households
Number Size
Bedminster 789 3.26
Bernards Twp. 3087 3.74
Bernardsville 2018 3.30
SOURCE
/sys/src/cmd/tbl
SEE ALSO
troff(1), eqn(1), doctype(1)
M. E. Lesk and L. L. Cherry, ``TBL--a Program to Format Tables'', Unix Research System Programmer's Manual, Tenth Edition, Volume 2.
TBL(1)