Sponsored Content
Top Forums Shell Programming and Scripting Count number of character occurence but not from quotation marks Post 302595498 by birei on Friday 3rd of February 2012 10:00:24 AM
Old 02-03-2012
Hi calinlicj,

One way. Remove all characters between double-quotes and then count semicolons:
Code:
$ perl -ne 's/"[^"]*"//g; printf qq[%d\n], tr/;/;/' <<<'31-01-2012, 09:42:37;OK;94727132638;"Mozilla/5.0 (Linux; U; Android 2.2.1)";3G;WAP;'
6

Regards,
Birei
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

hw can i count the number of character in a file by perl

i want to count the number of character contained in afile using perl cript help me out (1 Reply)
Discussion started by: trupti_rinku
1 Replies

2. Shell Programming and Scripting

enclose a line with quotation marks

i have a file like this aaaa bbbb cccc aaa aaaa aa cccccccccccccccc aaaaaaa aaaa aaaa i want to enclose this lines with double quotation: "aaaa bbbb cccc" "aaa aaaa" "aa cccccccccccccccc" "aaaaaaa aaaa aaaa" any idea? (preferably without using sed) thanks in advance... (3 Replies)
Discussion started by: gfhgfnhhn
3 Replies

3. Shell Programming and Scripting

Count the number of occurence of perticular word from file

I want to count the number of occurence of perticular word from one text file. Please tell me "less" command is work in ksh or not. If it is not working then instead of that which command will work. :confused: (40 Replies)
Discussion started by: rinku
40 Replies

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

5. UNIX for Dummies Questions & Answers

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. (5 Replies)
Discussion started by: sumit207
5 Replies

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

7. Shell Programming and Scripting

Why double quotation marks doesn't work in ksh function parameters passing?

I'm working on AIX 6, ksh shell. The parameters are some strings quotated by double quotation marks which from a file. They are quotated because there may be spaces in them. Example: "015607" "10" " " "A"I want to pass these parameters to a shell function by writing the following command: ... (4 Replies)
Discussion started by: Shimmey
4 Replies

8. Shell Programming and Scripting

carriage returns within quotation marks causing new lines in csv

I have a csv file with 3 columns. Fields are comma delimited and strings are enclosed with quotation marks "". About 40% of the time, the line of values will start a new line thanks to carriage return characters within a string. Example: "apple","banana","orange" "pineapple","grape","straw... (6 Replies)
Discussion started by: koeji
6 Replies

9. Shell Programming and Scripting

Multiple carriage returns within quotation marks causing new lines in csv

There is a closed thread called "carriage returns within quotation marks causing new lines in csv" that I am unable to post to, so I am starting a new thread. The awk solution worked perfectly in most cases. We have some cases where there are multiple carriage returns within a single quoted... (9 Replies)
Discussion started by: Mary Roberts
9 Replies

10. Programming

Python Count Number Of Occurence

Hello, I have a programming assignment to count number of occurrences of hours in particular file. Below is the code: fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" largest = None fh = open(fname) counts = dict() test = list() for line in fh: ... (2 Replies)
Discussion started by: infinitydon
2 Replies
beagle::gpu::BeagleGPUImpl(3)					     HMSBEAGLE					     beagle::gpu::BeagleGPUImpl(3)

NAME
beagle::gpu::BeagleGPUImpl - SYNOPSIS
Inherits beagle::BeagleImpl. Public Member Functions int createInstance (int tipCount, int partialsBufferCount, int compactBufferCount, int stateCount, int patternCount, int eigenDecompositionCount, int matrixCount, int categoryCount, int scaleBufferCount, int resourceNumber, long preferenceFlags, long requirementFlags) int getInstanceDetails (BeagleInstanceDetails *retunInfo) int setTipStates (int tipIndex, const int *inStates) int setTipPartials (int tipIndex, const double *inPartials) int setPartials (int bufferIndex, const double *inPartials) int getPartials (int bufferIndex, int scaleIndex, double *outPartials) int setEigenDecomposition (int eigenIndex, const double *inEigenVectors, const double *inInverseEigenVectors, const double *inEigenValues) int setStateFrequencies (int stateFrequenciesIndex, const double *inStateFrequencies) int setCategoryWeights (int categoryWeightsIndex, const double *inCategoryWeights) int setPatternWeights (const double *inPatternWeights) int setCategoryRates (const double *inCategoryRates) int setTransitionMatrix (int matrixIndex, const double *inMatrix, double paddedValue) int setTransitionMatrices (const int *matrixIndices, const double *inMatrices, const double *paddedValues, int count) int getTransitionMatrix (int matrixIndex, double *outMatrix) int updateTransitionMatrices (int eigenIndex, const int *probabilityIndices, const int *firstDerivativeIndices, const int *secondDerivativeIndices, const double *edgeLengths, int count) int updatePartials (const int *operations, int operationCount, int cumulativeScalingIndex) int waitForPartials (const int *destinationPartials, int destinationPartialsCount) int accumulateScaleFactors (const int *scalingIndices, int count, int cumulativeScalingIndex) int removeScaleFactors (const int *scalingIndices, int count, int cumulativeScalingIndex) int resetScaleFactors (int cumulativeScalingIndex) int copyScaleFactors (int destScalingIndex, int srcScalingIndex) int calculateRootLogLikelihoods (const int *bufferIndices, const int *categoryWeightsIndices, const int *stateFrequenciesIndices, const int *cumulativeScaleIndices, int count, double *outSumLogLikelihood) int calculateEdgeLogLikelihoods (const int *parentBufferIndices, const int *childBufferIndices, const int *probabilityIndices, const int *firstDerivativeIndices, const int *secondDerivativeIndices, const int *categoryWeightsIndices, const int *stateFrequenciesIndices, const int *cumulativeScaleIndices, int count, double *outSumLogLikelihood, double *outSumFirstDerivative, double *outSumSecondDerivative) int getSiteLogLikelihoods (double *outLogLikelihoods) int getSiteDerivatives (double *outFirstDerivatives, double *outSecondDerivatives) template<> int getSiteLogLikelihoods (double *outLogLikelihoods) template<> int getSiteLogLikelihoods (double *outLogLikelihoods) template<> int getSiteDerivatives (double *outFirstDerivatives, double *outSecondDerivatives) template<> int getSiteDerivatives (double *outFirstDerivatives, double *outSecondDerivatives) Additional Inherited Members Author Generated automatically by Doxygen for HMSBEAGLE from the source code. Version 1.0.0 Fri May 25 2012 beagle::gpu::BeagleGPUImpl(3)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy