Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to count the occurence of a character in a line Post 302285461 by Dipali on Monday 9th of February 2009 02:57:55 AM
Old 02-09-2009
I have csv data with spaces like below:

1,number one,first
2,number two second
3, number three, third

i want to count no. of commas in each line.
how to achieve that.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting occurence of a particular character on each line

Hi, I have the following data in a flat file: abcd_efgh_ijkl_20080522.dat|20080602222508|1357 abcd_efgh_ijkl_20080522.dat|20080602222508|1357 abcd_efgh_ijkl_20080522.dat|20080602222508|1357 I need to check the no. of occurence of "|" (pipe) on each line and the output should look like below:... (4 Replies)
Discussion started by: hey_mak
4 Replies

2. UNIX for Advanced & Expert Users

How to count the occurence of a character in a line

Suppose i have data like :- 1,2,3,4,5 a,b,c x,y,z,t I want to count the occurence of , (comma) in every line. Waiting for a solution.:) (1 Reply)
Discussion started by: sumit207
1 Replies

3. 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

4. Shell Programming and Scripting

Count character in one line

Please check the attachment for the example. Purpose: count how many "|" character in one line and also display the line number. expect result: Line 1 : there are 473 "|" characters Line 2 : there are 473 "|" characters I have tried to use awk to count it, it's ok when the statistic... (8 Replies)
Discussion started by: ambious
8 Replies

5. Shell Programming and Scripting

Count number of character occurence but not from quotation marks

I have the following string: 31-01-2012, 09:42:37;OK;94727132638;"Mozilla/5.0 (Linux; U; Android 2.2.1)";3G;WAP;I need a script which is counting the occurrence of semicolons ( ; ) but exclude the ones from the quotation marks. In the string given as example there are 8 semicolons but the script... (3 Replies)
Discussion started by: calinlicj
3 Replies

6. UNIX for Dummies Questions & Answers

Script to count character present in a line

Suppose i have multiple line like below in a file. ASDFAFAGAHAHAHA AGAHAHAJGAFAGAH AHAHAKAHAHAHAKA I need a bash script to count a character and also Also count the number of character present in each line . suppose for line 1: A=x, S=y, D=x and so on and total character=15. where x y and z is... (3 Replies)
Discussion started by: XXLMMN
3 Replies

7. Shell Programming and Scripting

Character count of each line

Hi, I have a file with more than 1000 lines. Most of the lines have 16 characters. I want to find out lines that have less than 14 characters (usually 12 or 13). wc -l gives me the line count and wc -c gives me the total characters in a file. I could not get the total characters for each line.... (1 Reply)
Discussion started by: bobbygsk
1 Replies

8. UNIX for Dummies Questions & Answers

Getting the character count of the last line

I need the character count of the last line of each file in a directory, and not the total. Now I have been doing this but unfortunately, -exec doesn't support pipes: find sent/ -type f -exec tail -1|wc -c {} \; If I try this: find sent/ -type f -exec tail -1 {} \; | wc -c It will give... (6 Replies)
Discussion started by: MIA651
6 Replies

9. Shell Programming and Scripting

sed - remove begin of line up to the third and including occurence of character

hello. How to remove all characters in a line from first character ( a $ ) until and including the third occurrence of that character ( $ ). Any help is welcome. (10 Replies)
Discussion started by: jcdole
10 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
poolstat(1M)															      poolstat(1M)

NAME
poolstat - report active pool statistics SYNOPSIS
poolstat [-p pool-list] [-r rset-list] [interval [count]] poolstat [-p pool-list] [-o format -r rset-list] [interval [count]] The poolstat utility iteratively examines all active pools on the system. It reports statistics based on the selected output mode. poolstat provides options to examine only specified pools and report resource set-specific statistics. Without options, poolstat examines all pools, reports basic statistics for their resource sets, and exits. DISPLAY FORMATS In default output format, poolstat outputs a header line and a line for each pool. The line begins with the pool ID and its name, followed by a column of statistical data for the processor set attached to the pool. The columns are defined as follows: id Pool ID. pool Pool name. rid Resource set id. rset Resource set name. type Resource set type. min Minimum resource set size. max Maximum resource set size. size Current resource set size. used The measure of how much of the resource set is currently is use. This is calculated as the percentage utilization of the resource set multiplied by its size. If resource set has been reconfigured during last sampling interval, this value might be not reported (-). load The absolute representation of the load that is put on the resource set. For the definition of this property see libpool(3LIB). The following options are supported: -o format Report statistics according to the format specification given in format. See DISPLAY FORMATS. The -o option accepts lists as arguments. Items in a list can be either separated by commas or enclosed in quotes and sepa- rated by commas or spaces. You can specify multiple -o options. The format specification is interpreted as the whitespace separated concatenation of all the format option arguments. The -o option must be used in conjunction with the -r option. -p pool-list Report only pools whose names are in the given list. If the -r option is also used, this option selects only resource sets which belong to pools in the given list. Statistics for pools or resource sets are reported in the same order in which pool names are listed on the pool-list. Pool can be specified by name or by ID. The -p option accepts lists as arguments. Items in a pool-list can only be separated by spaces. -r rset-list Report resource set statistics. If the rset-list argument is "all", then all possible resource set types are selected. The -r option accepts lists as arguments. Items in a list can be either separated by commas or enclosed in quotes and sepa- rated by commas or spaces. The following resource set types are supported: all All resource set types pset Processor set The following operands are supported: count The number of times that the statistics are repeated. By default, poolstat reports statistics only once. If neither interval nor count are specified, statistics are reported once. If interval is specified and count is not, statistics are reported indefinitely. interval The sampling interval in seconds. If neither interval nor count are specified, statistics are reported once. If interval is specified and count is not, statistics are reported indefinitely. Example 1: Using poolstat The following example shows the default output from the poolstat utility: % poolstat pset id pool size used load 0 pool_default 4 3.6 6.2 1 pool_admin 4 3.3 8.4 Example 2: Reporting Resource Set Statistics The following example reports resource set statistics. % poolstat -r pset id pool type rid rset min max size used load 0 pool_default pset -1 pset_default 1 65K 2 1.2 8.3 1 pool_admin pset 1 pset_admin 1 1 1 0.4 5.2 2 pool_other pset -1 pset_default 1 65K 2 1.2 8.3 Resource sets attached to multiple pools, as pset_default in the example above, are listed multiple times, once for each pool. Example 3: Restricting the Output to the List of Pools The following example restricts the output to the list of pools % poolstat -p pool_default pset id pool size used load 0 pool_default 8 5.3 10.3 % poolstat -p 'pool_admin pool_default' pset id pool size used load 1 pool_admin 6 4.3 5.3 0 pool_default 2 1.9 2.0 % poolstat -r all -p 'pool_admin pool_default' id pool type rid rset min max size used load 1 pool_admin pset 1 pset_admin 1 1 1 0.9 2.3 2 pool_default pset -1 pset_default 1 65K 2 2.0 2.0 Example 4: Customizing Output The following example customizes output: % poolstat -r -o pool,rset,size,load pool rset size load pool_default pset_default 4 4.5 pool_admin pset_admin 4 2.1 The following exit values are returned: 0 Successful completion. 1 An error occurred. 2 Invalid command line options were specified. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpool | +-----------------------------+-----------------------------+ |Stability |Evolving | +-----------------------------+-----------------------------+ libpool(3LIB), attributes(5) The system ids associated with resources can change after the system reboots or the resource configuration is altered. 15 Feb 2005 poolstat(1M)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy