UNIX script generate report grouped on date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX script generate report grouped on date
# 1  
Old 05-30-2013
UNIX script generate report grouped on date

Dear Team,
I am try n gerrating a report by writing a shell script, the content of the report should be aggrigated based on date value exist in the content of the file. initially the file is zip format
My file content is in below format
Code:
031627787  034626800357002013050613310400000013500 CLT01 V1BTAG31627787 0000 AMK0
031627787    0313557408002013050613341700000007000 CLT01 GRAZM231627787 0000 AMK0
031627787    0316579457002013050713335900000067200 CLT01 GEIDOR31627787 0000 AMK0
031627787  046329433121002013050713443800000024200 CLT01 KLAGSU31627787 0000 AMK0
i am calculating number of calls based on date as where $PrevDay is the Previous date value
calls=`gunzip -c -v $HOME/$path1/$profile/cdr/*$FileDate*.cdr.gz|awk -v date=$PrevDay\
'{ if (substr($0,43,8)== date) summe=summe+1}END {print summe}'`

File contains the date in the data of 2nd column, report should aggrigate data based on call date in 2nd column, e.g calls for 20130506 should come in one row and calls for 201307 should come in 2nd row. This call_date and values in the file should have a specific index location in the file. As our call date starts from 43 and is length 8

Only requirement is to find out such call_date from the file calculate number of call as above script is calculating.
The report output in report would be like
data1 data2 data3 call_date1 data4
data1 data2 data3 call_date2 data4

Kindly suggest.

Last edited by balram0179; 05-31-2013 at 07:28 AM..
# 2  
Old 05-31-2013
The necessary algorithm is called a "control break", you might want to read this tutorial on how to do it.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX script to replace old date with current date dynamically in multiple files present in a folder

I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with RTG and 3rd column=TD8 I want to substring the date part and I want to replace with currentdate minus 15 days. Here is an example. iam using AIX server $ cat temp.txt RTG*888*TD8*20180201~... (1 Reply)
Discussion started by: Shankar455
1 Replies

2. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

3. Shell Programming and Scripting

Shell script to generate report for each user ?

I have 3 user in my linux machine let's say a,b,c .By Using last command I am able to identify list of last logged in user and by w command who is logged in and what they are doing and by history command all command used by particular user all will be shown. Now I want to write shell script... (1 Reply)
Discussion started by: beingswarupmall
1 Replies

4. Shell Programming and Scripting

How to generate HTML page from UNIX script out-put?

Hi All. This my first post to this forum, and i assuming it will be best out-of all. I am quite new to Unix scripting so please excuse me for any silly questions - I am trying to create on Unix script in which it telnet to my server, check the connectivity of the server and then it... (2 Replies)
Discussion started by: HHarsh
2 Replies

5. Shell Programming and Scripting

Need a script that generate a report from a combined sudoers

Hello Gurus Is anyone aware of a script/utility that can be used to generate a report from a combined "sudoers" file for more than 100 servers in one go please? Basic query: Which particular user or an user group can execute root equivalent commands or has the ability for e.g. to do a... (1 Reply)
Discussion started by: kapil514
1 Replies

6. Web Development

Automation Script to generate SLA report as PPT

Hi All, We have one client.for this client some jobs got scheduled. Those jobs will run daily/weekly/Monthly. But once it runs it will generate some log files with date and Timestamp. In log folder it contains the complete logs of that particular job. By end of every month we are going to take... (0 Replies)
Discussion started by: vasuvv
0 Replies

7. Solaris

How to generate graph from flat file by using unix script

Hi, I need to generate graph from the text file in Unix server. The file contains the following data, Fri Feb 03 07:01:00 PST 2012|3325 Fri Feb 03 07:02:00 PST 2012|3349 Fri Feb 03 07:03:00 PST 2012|3290 Fri Feb 03 07:04:00 PST 2012|3496 Fri Feb 03 07:05:00 PST 2012|3362 Fri Feb 03 07:06:00... (2 Replies)
Discussion started by: gkn
2 Replies

8. Shell Programming and Scripting

Generate quarter dates with begin date and end date

Hi All, I am trying to generate quarter dates with user giving input as begin date and end date. Example: Input by user: begin_date = "2009-01-01" end_date = 2010-04-30" required output: 2009-01-01 2009-03-31 09Q01 2009-04-01 2009-06-30 09Q02 . . till 2010-01-01 2010-03-31 10Q01 ... (9 Replies)
Discussion started by: sol_nov
9 Replies

9. Shell Programming and Scripting

generate a report

I am trying to generate a report for a file called phone_book awk -f {phone_book} why does this not work? Nothing happens at all. (2 Replies)
Discussion started by: gustave
2 Replies

10. Shell Programming and Scripting

generate a report

Hi Please help me to resolve the below query. My shell script has generated a file output.file like below ******************************** DROP TABLE GPS_CONTACT_DETAILS DB20000I The SQL command completed successfully. CREATE TABLE GPS_CONTACT_DETAILS ( CONTACT_ID ... (8 Replies)
Discussion started by: sailaja_80
8 Replies
Login or Register to Ask a Question