Sponsored Content
Operating Systems HP-UX count occurences of specific character in the file Post 302183293 by anothersolution on Tuesday 8th of April 2008 05:11:25 PM
Old 04-08-2008
Another solution

This sort of thing should also work:
sed -e 's/[^myChar]//g' myFile | wc -c
where myChar is the character you are searching for and myFile is the file you are searching in.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to count no of occurences of a character in a string in UNIX

i have a string like echo "a|b|c" . i want to count the | symbols in this string . how to do this .plz tell the command (11 Replies)
Discussion started by: kamesh83
11 Replies

2. Shell Programming and Scripting

grep and count no of occurences in every line of a file

Hi Folks, I have a input file of the below format. ~~~OLKIT~OLKIT~1~~TBD~BEST PAGER & WIRELESS~4899 COMMON MARKET PLACE~~~DUBLIN~KS~43016~I~Y~DIRECT~D~~0 BPGRWRLS~~~OLKIT~OLKIT~1~~TBD~BEST PAGER & WIRELESS~4899 COMMON MARKET PLACE~~~DUBLIN~KS~43016~I~Y~DIRECT~D~~0... (12 Replies)
Discussion started by: srikanthgr1
12 Replies

3. Shell Programming and Scripting

Count specific character(s) very large file

I'm trying to count the number of 2 specific characters in a very large file. I'd like to avoid using gsub because its taking too long. I was thinking something like: awk '-F' { t += NF - 1 } END {print t}' infile > outfile which isn't working Any ideas would be great. (3 Replies)
Discussion started by: dcfargo
3 Replies

4. UNIX for Dummies Questions & Answers

How to count the occurences of a specific word in a file in bash shell

Hello, I want to count the occurences of a specific word in a .txt file in bash shell. Can somebody help me pleaze?? Thanks!!! (2 Replies)
Discussion started by: mskart
2 Replies

5. Shell Programming and Scripting

Count number of occurences of a character in a field defined by the character in another field

Hello, I have a text file with n lines in the following format (9 column fields): Example: contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Discussion started by: s052866
3 Replies

6. Shell Programming and Scripting

Count of matched pattern occurences by time in a log file

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

7. UNIX for Advanced & Expert Users

Count specific word or character per line

Hi, I need help regarding counting specific word or character per line and validate it against a specific number i.e 10. And if number of character equals the specific number then that line will be part of the output. Specific number = 6 Specific word or char = || Sample data:... (1 Reply)
Discussion started by: janzper
1 Replies

8. Shell Programming and Scripting

Count occurences of a character in a file by sorting results

Hello, I try to sort results of occurences in an array by using awk but I can't find the right command. that's why I'm asking your help ! :) Please see below the command that I run: awk '{ for ( i=1; i<=length; i++ ) arr++ }END{ for ( i in arr ) { print i, arr } }' dictionnary.txt ... (3 Replies)
Discussion started by: destin45
3 Replies

9. UNIX for Dummies Questions & Answers

To count total of specific character in a file and save its value to a variable

Hi all, I have a file that contains characters. How do I get total of spesific character from that file and save the count to a variable for doing for calculation. data.txt 1 2 2 2 2 3 3 4 5 6 7 8 5 4 3 4 (5 Replies)
Discussion started by: weslyarfan
5 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
HESINFO(1)						      General Commands Manual							HESINFO(1)

NAME
hesinfo - find out what is stored in the Hesiod database SYNOPSIS
hesinfo [-bl] HesiodName HesiodNameType DESCRIPTION
hesinfo takes two arguments, a name to be resolved and a string, known as a HesiodNameType. It then prints the information returned by the Hesiod nameserver. The value returned by hesinfo is of the type HesiodNameType. hesinfo understands the following options: -l Selects long format. -b Prints the fully-qualified string passed to the nameserver. VALID Hesiod_Names The following types of identifiers may be used in the HesiodName argument to hesinfo. These values will be resolved by accessing the hes- iod database. <username> the 8-character-or-less string used to identify users or classes (e.g. joeuser, root, 1.00, etc). Used with the Hesiod_Name_Types passwd, pobox, and filsys. <uid> the id number assigned to a user. <groupid> the id number assigned to a group. <groupname> a name identifying a unique group. <file-system-name> the name of an athena file system. <rvd server>:<pack> the name of an rvd's server and pack seperated by a colon. <nfs server>:<partition> the name of an nfs server and its partition seperated by a colon. <workstation-name> the machine name of an Athena workstation (e.g. E40-343-3). <service-name> name of an Athena service (e.g. Zephyr). <service-type> name of Unix service (valid entries are defined in /etc/services). <printer-name> name of a printer. <printer-cluster-name> name of an Athena print cluster. <foo> some hesinfo calls (e.g. prclusterlist ) do not require a specific HesiodName argument. However, you must include a dummy string (e.g. 'foo') for hesinfo to work properly. VALID Hesiod_Name_Types The following symbols are valid substitutions for the HesiodNameType argument to hesinfo. passwd returns string suitable for inclusion in /etc/passwd, searching with <username>. pobox returns information on the pobox assigned to the user specified by HesiodName, searching with <username>. uid returns string suitable for inclusion in /etc/passwd, searching with <uid>. gid returns string suitable for inclusion in /etc/group, searching with <groupid>. group returns string suitable for inclusion in /etc/group, searching with <groupname>. grplist returns subgroups included in superset defined by <groupname>. filsys returns file system type, export point, server, mount mode, and import point for the following valid HesiodNames (see above) - <file system name>, <username>, <rvd server>:<pack>, and <nfs server>:<partition> cluster returns information about the local cluster the workstation, specified by <workstation name>. Included is information about the local file and print servers. This information is accesses by clusterinfo at boot time. sloc returns network name of service host for <service-name>. service returns Internet protocol type and protocol service port for <service-type>. pcap returns a valid entry for /etc/printcap for <printer-name>. prcluserlist returns a list of print clusters. prcluster returns a list of printers in a cluster specified by <printer-cluster-name>. FILES
/etc/hesiod.conf SEE ALSO
`Hesiod - Project Athena Technical Plan -- Name Service', named(8), hesiod(3) AUTHOR
Steve Dyer, IBM/Project Athena Copyright 1987, 1988, 1996 by the Massachusetts Institute of Technology. 27 October 1996 HESINFO(1)
All times are GMT -4. The time now is 12:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy