Sponsored Content
Top Forums Shell Programming and Scripting Extract count of string in all files and display on date wise Post 302959951 by VasuKukkapalli on Sunday 8th of November 2015 12:05:56 PM
Old 11-08-2015
Thank you So much Don Cragun Sir, it works for me and giving the correct results.

Hello Rudi,

Thank you for spending your time!
i am getting the count from individual files, not on date wise, please find the output below:

Code:
Count 505:  , date: 2015-06-21
Count 602: 351 , date: 2015-06-21
Count 505:  , date: 2015-06-21
Count 602: 89 , date: 2015-06-21
Count 505:  , date: 2015-06-21
Count 602: 167 , date: 2015-06-21
Count 505: 10 , date: 2015-06-21
Count 602: 460 , date: 2015-06-21
Count 505: 14 , date: 2015-06-21
Count 602: 612 , date: 2015-06-21
Count 505: 16 , date: 2015-06-21
Count 602: 547 , date: 2015-06-21
Count 505: 7 , date: 2015-06-21
Count 602: 469 , date: 2015-06-21
Count 505: 2 , date: 2015-06-21
Count 602: 464 , date: 2015-06-21
Count 505: 1 , date: 2015-06-22
Count 602: 201 , date: 2015-06-22
Count 505:  , date: 2015-06-22
Count 602: 47 , date: 2015-06-22
Count 505: 1 , date: 2015-06-22
Count 602: 127 , date: 2015-06-22
Count 505: 15 , date: 2015-06-22
Count 602: 492 , date: 2015-06-22
Count 505: 41 , date: 2015-06-22
Count 602: 557 , date: 2015-06-22
Count 505: 27 , date: 2015-06-22
Count 602: 475 , date: 2015-06-22
Count 505: 23 , date: 2015-06-22
Count 602: 411 , date: 2015-06-22
Count 505: 4 , date: 2015-06-22
Count 602: 382 , date: 2015-06-22
Count 505: 1 , date: 2015-06-23
Count 602: 217 , date: 2015-06-23
Count 505:  , date: 2015-06-23
Count 602: 139 , date: 2015-06-23
Count 505: 17 , date: 2015-06-23
Count 602: 450 , date: 2015-06-23
Count 505: 27 , date: 2015-06-23
Count 602: 526 , date: 2015-06-23
Count 505: 32 , date: 2015-06-23
Count 602: 461 , date: 2015-06-23
Count 505: 22 , date: 2015-06-23
Count 602: 457 , date: 2015-06-23
Count 505: 8 , date: 2015-06-23
Count 602: 446 , date: 2015-06-23
Count 505:  , date: 2015-06-24
Count 602: 165 , date: 2015-06-24
Count 505:  , date: 2015-06-24
Count 602: 60 , date: 2015-06-24
Count 505:  , date: 2015-06-24
Count 602: 147 , date: 2015-06-24
Count 505: 26 , date: 2015-06-24
Count 602: 485 , date: 2015-06-24
Count 505: 31 , date: 2015-06-24
Count 602: 522 , date: 2015-06-24
Count 505: 33 , date: 2015-06-24
Count 602: 486 , date: 2015-06-24
Count 505: 13 , date: 2015-06-24
Count 602: 353 , date: 2015-06-24
Count 505: 3 , date: 2015-06-24
Count 602: 352 , date: 2015-06-24

But i need output like below:

Code:
Count for 505001: 49 on date: 2015-06-21
Count for 602001: 3159 on date: 2015-06-21
Count for 505001: 112 on date: 2015-06-22
Count for 602001: 2692 on date: 2015-06-22
Count for 505001: 107 on date: 2015-06-23
Count for 602001: 2696 on date: 2015-06-23
Count for 505001: 106 on date: 2015-06-24
Count for 602001: 2570 on date: 2015-06-24

Basically the consolidate count on date wise...

Last edited by VasuKukkapalli; 11-08-2015 at 01:10 PM.. Reason: Adding more detail
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display the count of files

I am new to shell programming. Can anyone help me out with anyone of these? Display a count of the number of regular files, the number of symbolic links, the number of sub-directories, the number of block-special files, and the number of character-special files in the directory. I don't... (4 Replies)
Discussion started by: wayne1411
4 Replies

2. Shell Programming and Scripting

To extract data of a perticular interval (date-time wise)

I want a shell script which extract data from a log file which contains date and time-wise data and i need the data for a perticular interval of time...what can i do??? (3 Replies)
Discussion started by: abhishek27
3 Replies

3. Shell Programming and Scripting

Need to zip the files date wise --urgent Help needed

Hi all, this is my first post, i need to write a script to zip the files with datewise below are the log files. -rw------- 1 root sso 85316156 May 24 22:11 core_test_smservaz_104_104_1243217459_8896 -rw------- 1 root sso 90413304 May 25 22:12 core_test_smservaz_104_104_1243303895_20912... (4 Replies)
Discussion started by: lcschandu
4 Replies

4. Solaris

delete files by date wise

Hi guys, I want to delete files from june 13 to june 30, using rm command can any one tell me the sintax to remove. I ahve hunderd of core files in my /var dir. so i want to clear last month core files. Thanks in Advance.:)) (2 Replies)
Discussion started by: kurva
2 Replies

5. Shell Programming and Scripting

Extract string from multiple file based on line count number

Hi, I search all forum, but I can not find solutions of my problem :( I have multiple files (5000 files), inside there is this data : FILE 1: 1195.921 -898.995 0.750312E-02-0.497526E-02 0.195382E-05 0.609417E-05 -2021.287 1305.479-0.819754E-02 0.107572E-01 0.313018E-05 0.885066E-05 ... (15 Replies)
Discussion started by: guns
15 Replies

6. Shell Programming and Scripting

How to read files by Server Creation date wise?

Hi All, I would have many files in the server with xyz*.dat -- Static file name Physical files: xyz1.dat - 01PM xyz2.dat - 02PM xyz3.dat - 03PM In present version we are using for f in $file_name do fname=`ls $f | grep -v ^'\|'$ | sed s/' '/'\\ '/g` .... sqlldr... (4 Replies)
Discussion started by: Dharv
4 Replies

7. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

8. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies

9. Shell Programming and Scripting

Count the number of string occurrences to display 0 entries in output

Hello Friends, Can somebody assist an issue I am having? I have a separate file with a list of account ids XXX200B02Y01 XXX200B03Y01 XXX200B05Y01 XXX200B07Y01 XXX200B08Y01 I call the file, and run an egrep against a directory and logfiles AccountID=$(cat... (2 Replies)
Discussion started by: liketheshell
2 Replies

10. Shell Programming and Scripting

Search string in multiple files and display column wise

I have 3 files. Each of those files have the same number of records, however certain records have different values. I would like to grep the field in ALL 3 files and display the output with only the differences in column wise and if possible line number File1 Name = Joe Age = 33... (3 Replies)
Discussion started by: sidnow
3 Replies
SYSPROFILE(8)						      System Manager's Manual						     SYSPROFILE(8)

NAME
sysprofile - modular centralized shell configuration DESCRIPTION
sysprofile is a generic approach to configure shell settings in a modular and centralized way mostly aimed at avoiding work for lazy sysad- mins. It has only been tested to work with the bash shell. It basically consists of the small /etc/sysprofile shell script which invokes other small shell scripts having a .bash suffix which are contained in the /etc/sysprofile.d/ directory. The system administrator can drop in any script he wants without any naming convention other than that the scripts need to have a .bash suffix to enable automagic sourcing by /etc/sysprofile. This mechanism is set up by inserting a small shell routine into /etc/profile for login shells and optionally into /etc/bashrc and/or /etc/bash.bashrc for non-login shells from where the actual /etc/sysprofile script is invoked: if [ -f /etc/sysprofile ]; then . /etc/sysprofile fi For using "sysprofile" under X11, one can source it in a similar way from /etc/X11/Xsession or your X display manager's Xsession file to provide the same shell environment as under the console in X11. See the example files in /usr/share/doc/sysprofile/ for illustration. For usage of terminal emulators with a non-login bash shell under X11, take care to enable sysprofile via /etc/bash.bashrc. If not set this way, your terminal emulators won't come up with the environment defined by the scripts in /etc/sysprofile.d/. Users not wanting /etc/sysprofile to be sourced for their environment can easily disable it's automatic mechanism. It can be disabled by simply creating an empty file called $HOME/.nosysprofile in the user's home directory using e.g. the touch(1) command. Any single configuration file in /etc/sysprofile.d/ can be overridden by any user by creating a private $HOME/.sysprofile.d/ directory which may contain a user's own version of any configuration file to be sourced instead of the system default. It's names have just to match exactly the system's default /etc/sysprofile.d/ configuration files. Empty versions of these files contained in the $HOME/.syspro- file.d/ directory automatically disable sourcing of the system wide version. Naturally, users can add and include their own private script inventions to be automagically executed by /etc/sysprofile at login time. OPTIONS
There are no options other than those dictated by shell conventions. Anything is defined within the configuration scripts themselves. SEE ALSO
The README files and configuration examples contained in /etc/sysprofile.d/ and the manual pages bash(1), xdm(1x), xdm.options(5), and wdm(1x). Recommended further reading is everything related with shell programming. If you need a similar mechanism for executing code at logout time check out the related package syslogout(8) which is a very close compan- ion to sysprofile. BUGS
sysprofile in its current form is mainly restricted to bash(1) syntax. In fact it is actually a rather embarrassing quick and dirty hack than anything else - but it works. It serves the practical need to enable a centralized bash configuration until something better becomes available. Your constructive criticism in making this into something better" is very welcome. Before i forget to mention it: we take patches... ;-) AUTHOR
sysprofile was developed by Paul Seelig <pseelig@debian.org> specifically for the Debian GNU/Linux system. Feel free to port it to and use it anywhere else under the conditions of either the GNU public license or the BSD license or both. Better yet, please help to make it into something more worthwhile than it currently is. SYSPROFILE(8)
All times are GMT -4. The time now is 09:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy