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
filtercalltree(1)					    BSD General Commands Manual 					 filtercalltree(1)

NAME
filtercalltree -- Filter or prune a call tree file generated by sample or malloc_history SYNOPSIS
filtercalltree call-tree-file [-invertCallTree] [-pruneCount count] [-pruneMallocSize size] [-chargeSystemLibraries] [-chargeLibrary libraryName] [-keepBoundaries] DESCRIPTION
filtercalltree reads a file containing a call tree, as generated by the sample(1) or malloc_history(1) commands, and filters or prunes it as specified by the options. OPTIONS
-invertCallTree Print the call tree from hottest to coldest stack frame. -pruneCount count Remove branches of the call tree that have count less than count -pruneMallocSize size Remove branches of the call tree that have malloc size less than size, such as 500K or 1.2M. -chargeSystemLibraries Remove stack frames from all libraries in /System and /usr, while still charging their cost to the caller. -chargeLibrary library-name Remove stack frames from library-name, while still charging their cost to the caller. This argument can be repeated for multiple libraries. -keepBoundaries When charging libraries to callers, keep the top call into excluded libraries. SEE ALSO
malloc_history(1), sample(1) BSD
May 7, 2011 BSD
All times are GMT -4. The time now is 08:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy