07-06-2009
Help me in counting records from file
Hi,
Please help me in counting the below records(1st field) from samplefile:
Expected output:
Count Descr
-------------------------------------------
7 Mean manager
14 Mean2 manager
Samplefile
Mean manager 414d51204c50505741373636202020200073174ab99c
Mean manager 414d51204c50505741373636202020200073174acaba
Mean manager 414d51204c50505741373636202020200073174aceba
Mean manager 414d51204c50505741373637202020207e363a4a01f0
Mean manager 414d51204c50505741373637202020207e363a4a01f1
Mean manager 414d51204c50505741373637202020207e363a4aaae7
Mean manager 414d51204c50505741383134202020209e82204a22f7
Mean2 manager 414d51204c5050574135333720202020a64e234a5fc3e522
Mean2 manager 414d51204c50505741353338202020202e71234a191cda22
Mean2 manager 414d51204c50505741353338202020202e71234aa313da22
Mean2 manager 414d51204c5050574136333920202020ef7b234adb9bde22
Mean2 manager 414d51204c5050574136343020202020cc90234a8db9e022
Mean2 manager 414d51204c5050574137313020202020975a2b4add499223
Mean2 manager 414d51204c50505741373131202020201d532b4a39b57523
Mean2 manager 414d51204c505057413731342020202046a12c4a4d6c7322
Mean2 manager 414d51204c5050574137313520202020edac2c4a31b57022
Mean2 manager 414d51204c505057413731372020202052be2c4a83c87022
Mean2 manager 414d51204c505057413731372020202052be2c4ae3dd7022
Mean2 manager 414d51204c505057413731382020202094c52c4aa9619523
Mean2 manager 414d51204c505057413731392020202032ce2c4a4db38623
Mean2 manager 414d51204c505057413731392020202032ce2c4a5bc28623
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies
2. UNIX for Dummies Questions & Answers
file_in_1:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
25 26 27 28
29 30 31 32
file_in_2:
9 10 11 12
21 22 23 24
1 2 3 4
17 18 19 20
file_out: (5 Replies)
Discussion started by: kenneth.mcbride
5 Replies
3. Shell Programming and Scripting
I've been working with an awk script and I'm wondeing id it's possible to count records in a file which DO NOT contain, in this instance fields 12 and 13.
With the one script I am wanting to display the count for the records WITH fields 12 and 13 and a seperate count of records WITHOUT fields... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies
4. Shell Programming and Scripting
Hi every one;
I have a 31500-line text file upon which two following tasks are to be performed:
1: Rearranging the file
2: Taking the average of each column (considering number of zeros) and output the result into a new file
This is the code I've come up with:
awk '(NR%3150<3150)... (0 Replies)
Discussion started by: nxp
0 Replies
5. Programming
Please find the below program. It contains the purpose of the program itself.
/* Program : Write a program to count the number of words in a given text file */
/* Date : 12-June-2010 */
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main( int argc, char *argv )
{... (6 Replies)
Discussion started by: ramkrix
6 Replies
6. UNIX for Dummies Questions & Answers
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies
7. Shell Programming and Scripting
HI,
i have a file like this
t.txt
f1|_f2|_
f1|_f2|_
f1|_f2|_
as if col delimiter is |_ and row delimiter |_\n
trying to count number of records using awk
$ awk 'BEGIN{FS="|_" ; RS="~~\n"} {n++}END{print n} ' t.txt
7
wondering how can i count this to 3 ?
thx (9 Replies)
Discussion started by: aksforum
9 Replies
8. Shell Programming and Scripting
I have 2 files
"File 1" is delimited by ";" and "File 2" is delimited by "|".
File 1 below (3 record shown):
Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones
Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull
Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Discussion started by: vestport
2 Replies
9. Shell Programming and Scripting
Hi Unix team,
I have a file with 30 columns with tab delimited. I need to count the records based on column 18 & 21 data.
So I cut the data from the file using
awk -F"\t" '{print $18,$21}' foo.txt
Following is the output:
USED SEDAN
USED SUV
NEW SUV
USED Truck
USED Truck
USED... (6 Replies)
Discussion started by: karumudi7
6 Replies
10. Shell Programming and Scripting
Hi I am new to shell programming in unix
Please if I can provide help.
I have a file structure of a header record and "N" detail records.
The header record will be the total number of detail records
I need to split the file in 2:
One for the header
Another for all detail records
Could... (1 Reply)
Discussion started by: jamcogar
1 Replies
LEARN ABOUT DEBIAN
lsrealm
LSREALM(1p) User Contributed Perl Documentation LSREALM(1p)
NAME
lsrealm - List the realms in a DNSSEC-Tools realm file
SYNOPSIS
lsrealm [options] <realm-files>
DESCRIPTION
This script lists the contents of the specified realm files. All realm files are loaded before the output is displayed. If any realms
have duplicated names, whether within one file or across multiple files, the later realm will be the one whose data are displayed.
The output displayed for each realm in a realm file depends on the selected records, the selected attributes, and the selected output
format. Each option in these option groups is described in detail in the next section. The three base output formats are described here.
The -terse option indicates that a minimal amount of output is desired; the -long option indicates that a great deal of output is desired.
The record-selection and attribute-selection options may be used in conjunction with -terse to display exactly the set of realm fields
needed.
The default output format is that used when neither -terse nor -long is given, and is a middle ground between terse and long output.
The table below shows the fields displayed for each output format.
realm field default terse long
------------- ------- ----- ----
realm name yes yes yes
state yes no yes
config directory no no yes
realm directory no no yes
rollrec file no no yes
administrator no no yes
directory no no yes
display flag no no yes
manager no no yes
manager arguments no no yes
user no no yes
OPTIONS
There are three types of options recognized by lsrealm: record-selection options, attribute-selection options, and output-format options.
Each type is described in the subsections below.
Record-selection Options
These options select the records that will be displayed by lsrealm. By default, all records will be displayed; selecting one or the other
of these options will restrict the records shown.
These options are mutually exclusive.
-active
List all active records in the realm file.
-inactive
List all inactive records in the realm file.
Attribute-selection Options
These options select the attributes of the records that will be displayed by lsrealm.
-admin
The record's administrator value is included in the output. If an administrator value is not included in a realm, then the value
"(defadmin)" will be given.
-args
The record's user-defined arguments for the realm's rollover manager.
-configdir
The record's configuration directory is included in the output. This value will be the filename only, unless the -fullpaths option is
given. In that case, the full pathname will be printed.
-display
The record's display flag, used by grandvizier is included in the output.
-manager
The record's manager field, indicating which rollover manager is used for the realm.. The default is rollerd, but individual
installations may use other managers.
-realmdir
The record's realm directory is included in the output. This value will be the filename only, unless the -fullpaths option is given.
In that case, the full pathname will be printed.
-rollrec
The record's rollrec file is included in the output. This value will be the filename only, unless the -fullpaths option is given. In
that case, the full pathname will be printed.
-state
Include each realm record's state in the output. The state will be either "active" or "inactive". This field is part of the default
output.
-user
The record's user field, which is the user the realm's manager will be executed with. This field is not yet implemented.
Output-format Options
These options select the type of output that will be given by lsrealm.
-count
Only a count of matching realms in the realm file is given.
-fullpaths
Display pathname data as the full pathname given in the realm file. If this option is not specified, only the filename itself will be
displayed.
-headers
Display explanatory column headers.
-terse
Terse output is given. Only the record name and any other fields specifically selected are included in the output.
-long
Long output is given. All record fields are included.
-help
Display a usage message.
-Version
Displays the version information for lsrealm and the DNSSEC-Tools package.
COPYRIGHT
Copyright 2012 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details.
AUTHOR
Wayne Morrison, tewok@tislabs.com
SEE ALSO
dtrealms(8), grandvizier(8), realminit(8)
Net::DNS::SEC::Tools::realm.pm(3)
file-realm(5)
perl v5.14.2 2012-06-21 LSREALM(1p)