Sponsored Content
Full Discussion: count data separate by comma
Top Forums Shell Programming and Scripting count data separate by comma Post 302115369 by bucci on Tuesday 24th of April 2007 07:17:02 AM
Old 04-24-2007
hi Anbu,

sorry have a little mistake info, i means is want to count file by file and in file line by line which in the files data only have "01" in column 1 and "000000000000000000000000" in column 15 and "_" in column 16, the data in each files created can have different like in other file can have "000AB04" in column 16 or "00000000000000000000A74B" in column 15 but all count is reference to "01" in column 1.

lets say filename is ABC_2007040100-2007040105, ABC_2007040105-2007040110,etc

note : the file is created each 15 minutes

please help with simple script thanks

please advice


Thank you so much

Best Regards,

bucci




Quote:
Originally Posted by anbu23
Code:
for file in *.out
do
  awk -F"," ' {
   $15 == "01" || $15 == "000000000000000000000000" && $16 == "_" { arr[FILENAME]++; }
   END {  for( file in arr ) { print file ":" arr[file] } }
  ' $file
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

2. Shell Programming and Scripting

Pull Data After Comma if 2 word before comma

Hi, I am trying to truncate word after comma in a file ONLY if there are already 2 words BEFORE comma. If there is one word or 3 or more words BEFORE comma, then I have to leave the data AS IS. See below for example. Input File : John Smith, Manager Smith, John Frank J F K... (2 Replies)
Discussion started by: msalam65
2 Replies

3. UNIX for Dummies Questions & Answers

Separate text files in a folder by word count

Hi, been searching Google for like an hour and I doubt I got the right keywords so might as well ask here. What I need: Before: Article1.txt 564 Article2.txt 799 Article3.txt 349 Article4.txt 452 * Separate files over 400 wordcount * After: Article1.txt 564... (3 Replies)
Discussion started by: Richard2000
3 Replies

4. Shell Programming and Scripting

using diff to on two file but ignoring the last comma separate value

Hi guys I have two file which I sdiff. ie file 1: AA,12,34,56,,789,101,,6666 file 2: AA,12,34,56,,789,101,,7777 The last comma separated value will always change from one day to the next. Is there another unix utility I can use that will sdiff two files but ignore the last comma... (1 Reply)
Discussion started by: wny201
1 Replies

5. Shell Programming and Scripting

Count number of column in a comma delimited file

I have a comma (,) delimited file. 106232145,"medicare","medicare,medicaid",789 I would like to count the number of fields in each line. I tried the below code awk -F ',' '{print NF-1}' This returns me the result as 5 instead of 4. This is because the awk takes... (9 Replies)
Discussion started by: machomaddy
9 Replies

6. Shell Programming and Scripting

Count and separate entries with N/A mentioned in front

Hi all, I have afile with following data I want to separate, count the entries with N/A in front of it so I will have all the entries with N/A in front seprate file . so output shuld be (7 Replies)
Discussion started by: manigrover
7 Replies

7. Shell Programming and Scripting

Remove bracket part entires and separate entries after comma

Hi all This time my input conatin 3 columns: ERCC1 (PA155) Platinum compounds (PA164713176) Allele A is not associated with response to Platinum compounds in women with Ovarian Neoplasms as compared to allele C . CES1 (PA107) methylphenidate (PA450464) Genotype CT is not... (4 Replies)
Discussion started by: Priyanka Chopra
4 Replies

8. Shell Programming and Scripting

Separate Entries after comma

Hi All I need help to separate entries after commas in my I have 2 columns in my file like this Ramush, Shyam, Mohan First Ram, Mohan, Kaavya Second, Fourth Kavi, Ram, Shaym, Mohan Third I ahve to separate entries after comma in a separate row... (9 Replies)
Discussion started by: kareena
9 Replies

9. UNIX for Advanced & Expert Users

Comma separate issue in UNIX

In awk the field seprator is not working properly, I am trying to cut the fields from the file based on the delimiter example comma (,) awk -F, "{print {$1 FS $3 FS $5 FS FS $2}}" Sample.csv But i am not getting desired output can anyone help me how to check real ascii comma there in my... (9 Replies)
Discussion started by: rspwilliam
9 Replies

10. Shell Programming and Scripting

How to separate rows of data into another column?

I have data such as below where the value in second field is the same as that in the row after. 123456,22222,John,0,xyz 234567,22222,John1,1,cde 43212,3333,Jean,3,pip 84324,3333,Abel,2,cat I'd like to rearrange the output like below to put such records beside each other and separated with... (5 Replies)
Discussion started by: james2009
5 Replies
ocount(1)						      General Commands Manual							 ocount(1)

NAME
ocount - Event counting tool for Linux SYNOPSIS
ocount [ options ] [ --system-wide | --process-list <pids> | --thread-list <tids> | --cpu-list <cpus> [ command [ args ] ] ] DESCRIPTION
ocount is an OProfile tool that can be used to count native hardware events occurring in either a given application, a set of processes or threads, a subset of active system processors, or the entire system. The data collected during a counting session is displayed to stdout by default or, optionally, to a file. When counting multiple events, the kernel may not be able to count all events simultaneously and, thus, may need to multiplex the counting of the events. If this happens, the "Percent time enabled" column in the ocount output will be less than 100, but counts are scaled up to a 100% estimated value. RUN MODES
One (and only one) of the following run modes must be specified. If you run ocount using a run mode other than command [args] , press Ctrl-c to stop ocount when finished counting (e.g., when the monitored process ends). If you background ocount (i.e., with '&') while using one these run modes, you must stop it in a controlled manner so that the data collection process can be shut down cleanly and final results can be displayed. Use kill -SIGINT <ocount-PID> for this purpose. command [args] The command is the application for which to count events. args are the input arguments required by the application. The command and its arguments must be positioned at the end of the command line, after all ocount options. --process-list / -p pids Use this option to count events for one or more already-running applications, specified via a comma-separated list ( pids ). Event counts will be collected for all children of the passed process(es) as well. --thread-list / -r tids Use this option to count events for one or more already-running threads, specified via a comma-separated list ( tids ). Event counts will not be collected for any children of the passed thread(s). --system-wide / -s This option is for counting events for all processes running on your system. You must have root authority to run ocount in this mode. --cpu-list / -C cpus This option is for counting events on a subset of processors on your system. You must have root authority to run ocount in this mode. This is a comma-separated list, where each element in the list may be either a single processor number or a range of processor numbers; for example: '-C 2,3,4-11,15'. OTHER OPTIONS
--events / -e event1[,event2[,...]] This option is for passing a comma-separated list of event specifications for counting. Each event spec is of the form: name[:unitmask[:kernel[:user]]] Note: Do not include a count value in the event spec, as that parameter is only need when profiling. You can specify unit mask values using either a numerical value (hex values must begin with "0x") or a symbolic name (if the name=<um_name> field is shown in the ophelp output). For some named unit masks, the hex value is not unique; thus, OProfile tools enforce specifying such unit masks value by name. If no unit mask is specified, the default unit mask value for the event is used. Event names for certain processor types include a _GRP<n> suffix. For such cases, the --events option may be specified with or without the _GRP<n> suffix. When no event specification is given, the default event for the running processor type will be used for counting. Use ophelp to list the available events for your processor type. --separate-thread / -t This option can be used in conjunction with either the --process-list or --thread-list option to display event counts on a per- thread (per-process) basis. Without this option, all counts are aggregated. NOTE: If new threads are started by the process(es) being monitored after counting begins, the counts for those threads are aggre- gated with their parent's counts. --separate-cpu / -c This option can be used in conjunction with either the --system-wide or --cpu-list option to display event counts on a per-cpu basis. Without this option, all counts are aggregated. --time-interval / -i num_seconds[:num_intervals] Results collected for each time interval are printed every num_seconds instead of the default of one dump of cumulative event counts at the end of the run. If num_intervals is specified, ocount exits after the specified number of intervals occur. --brief-format / -b Use this option to print results in the following brief format: [optional cpu or thread,]<event_name>,<count>,<percent_time_enabled> [ <int> ,]< string >,< u64 >,< double > If --timer-interval is specified, a separate line formatted as timestamp,<num_seconds_since_epoch> is printed ahead of each dump of event counts. --output-file / -f outfile_name Results are written to outfile_name instead of interactively to the terminal. --verbose / -V Use this option to increase the verbosity of the output. --version / -v Show ocount version. --help / -h Display brief usage message. --usage / -u Display brief usage message. EXAMPLE
$ ocount make VERSION
This man page is current for oprofile-0.9.9. SEE ALSO
operf(1). oprofile 0.9.9 Tue 10 June 2014 ocount(1)
All times are GMT -4. The time now is 04:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy