Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need record count on every 30 minute Post 302968883 by RavinderSingh13 on Tuesday 15th of March 2016 12:57:35 PM
Old 03-15-2016
Hello,

I have used same Input_file provided by you, only thing I have added at last 23:59 as per your condition provided. Please note that variable named SUM will be printed only if line has 23:59 value. Let's say following is the Input_file.
Code:
cat Input_file
00:01   21
00:02   23
00:03   34
00:04   34
00:05   30
00:06   16
00:07   26
00:08   13
00:09   17
00:10   13
00:11   21
00:12   24
00:13   28
00:14   26
00:15   21
00:16   39
00:17   42
00:18   37
00:19   29
00:20   20
00:21   25
00:22   30
00:23   10
00:24   19
00:25   19
00:26   20
00:27   24
00:28   16
00:29   18
00:30   16
00:31   17
00:32   34
00:33   14
00:34   20
00:35   21
00:36   37
00:37   21
00:38   27
00:39   28
00:40   13
00:41   18
00:42   22
00:43   14
00:44   12
00:45   16
00:46   30
00:47   19
00:48   23
00:49   22
00:50   25
00:51   30
00:52   32
00:53   25
00:54   15
00:55   13
00:56   11
00:57   22
00:58   19
00:59   19
01:00   18
01:01   30
01:02   25
01:03   25
01:04   20
01:05   14
01:06   23
01:07   9
01:08   9
01:09   10
01:10   10
01:11   18
01:12   12
01:13   17
01:14   15
01:15   14
01:16   20
01:17   6
01:18   8
01:19   10
01:20   14
01:21   13
01:22   10
01:23   7
01:24   20
01:25   16
01:26   17
01:27   14
01:28   18
01:29   19
01:30   15
01:31   19
01:32   18
01:33   13
01:34   14
01:35   13
01:36   17
01:37   5
01:38   15
01:39   19
01:40   34
01:41   18
01:42   10
01:43   13
01:44   11
01:45   16
01:46   13
01:47   4
01:48   4
01:49   14
01:50   14
01:51   7
01:52   20
01:53   18
01:54   17
01:55   20
01:56   30
01:57   14
01:58   27
01:59   17
02:00   24
02:01   60
02:02   23
02:03   8
02:04   31
02:05   47
02:06   34
02:07   30
02:08   26
02:09   18
02:10   35
02:11   29
02:12   33
02:13   23
02:14   7
23:30   22

Following is the code then for same.
Code:
awk '{split($1, A,":");if(A[1]==23 && A[2]==30){print SUM};SUM+=$NF}' Input_file

Output is as follows.
Code:
2688

Let me know the complete details for requirement if above doesn't help you.

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count the record count in an EBCDIC file.

How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies

2. Shell Programming and Scripting

record count

i have a file named file_names.dat where there are several files along with their path. exp: /data1/dir1/CTA_ACD_20071208.dat /data1/dir1/CTA_DFG_20071208.dat i want to write a script which will create a csv file with the name of the file and record count of that file the output file... (4 Replies)
Discussion started by: dr46014
4 Replies

3. Shell Programming and Scripting

replaying a record count with another record count

i use unix command to take the record count for a file1 awk 'END{print NR}' filename i already have a file2 which conatin the count like ... .. rec_cnt=100 .. .. I want to replace the record in the file2 using the record i take from file1. suggest me some simple ways of doing it... (2 Replies)
Discussion started by: er_zeeshan05
2 Replies

4. UNIX for Advanced & Expert Users

character count per record

Hello can someone please advise. I need to send records in a file that are over 10,000 characters long to a seperate file. Any ideas? Thanks (2 Replies)
Discussion started by: Dolph
2 Replies

5. Shell Programming and Scripting

Validate record count

Hi all How to verify the number of records in case of delimited file, If the file has records. And then if it is not equal to mentioned no. of records, email is triggered and file is moved to bad directory path. Example ----- input file = a.txt bad directory path : /usr/bin/bad (6 Replies)
Discussion started by: balaji23_d
6 Replies

6. UNIX for Dummies Questions & Answers

Reduce the count on the 98 record by 2,

recod,amount,noofaccount,count 98,+00000187865779787,00319,000000640/ 99,+00000187865779787,00001,000000642/ thsi is my input file my question is 1) Reduce the count on the 98 record by 2 (6 Replies)
Discussion started by: sgoud
6 Replies

7. Shell Programming and Scripting

Count of matched pattern occurences by minute and date in a log file

Anyone knows how to use AWK to achieve the following Sun Feb 12 00:41:01-00:41:59 Success:2 Fail:2 Sun Feb 12 00:42:01-00:42:59 Success:1 Fail:2 Sun Feb 12 01:20:01-01:20:59 Success:1 Fail:2 Mon Feb 13 22:41:01-22:41:59 Success:1 Fail:1 log file: Success Success Fail Fail ... (9 Replies)
Discussion started by: timmywong
9 Replies

8. Shell Programming and Scripting

Take minute per minute from a log awk

Hi, I've been trying to develop a script that performs the parsing of a log every 1 minute and then generating some statistics. I'm fairly new to programming and this is why I come to ask if I can lend a hand. this is my log: xxxx 16/04/2012 17:00:52 - xxxx714 - E234 - Time= 119 ms.... (8 Replies)
Discussion started by: jockx
8 Replies

9. Shell Programming and Scripting

Validating the record count

Hi , I am having a text file with several records., it has a header record and trailer record. The header record has the number of rows (records) found in the text file and time-stamp. The footer record has the total number of records ( along with the header and trailer., Suppose: wc -l... (4 Replies)
Discussion started by: cratercrabs
4 Replies

10. Shell Programming and Scripting

count of record in files

Hi all, I have written a scripts which count number of lines in all the files in a directory and write in a text file. I don't know how to format it while writing. OS suns solaris 10 my scripts is as below for i in /ersdg3/ERS/ERS_INPUT_LOGS/RIO/LOGS/RIO_02-Aug-2012/ *.LOG do echo... (11 Replies)
Discussion started by: guddu_12
11 Replies
record(1)						      General Commands Manual							 record(1)

NAME
record - records *.wav files SYNOPSIS
record [ options ] DESCRIPTION
record records *.wav files in CD quality (i.e. 44100 Hz, 16bit, stereo). It has a input level meter, which might be useful for sound trou- ble shooting (check if the mixer settings ok for recording from the TV card etc.) OPTIONS
-h display help text -o file basename for the output file(s), a number and the .wav extension are added by record. Default is "record". -i dev mixer control. This should be the one where you can adjust the record level for your audio source. Default is "line". "mic" and "igain" are good candidates too. Best way to figure is to start your favorite mixer tool and check out which one works ... -m dev set mixer device. Default is "/dev/mixer". -d dev set audio device. Default is "/dev/dsp". -r rate set sample rate. Default is 44100. -p sec peak seconds (number of seconds which should be scanned for the volume maximum). This affects both peak level display and level triggered recording (see below). Default is 1.5 seconds. record can also be used non-interactive: -c enable console (non-interactive) mode. -v be verbose (console mode only). -t mm:ss Limit the record time (console mode only). By default record records until stopped by a signal (by typing ^C for example). -s size Limit the file size (console mode only). record will continue with a new file once the limit is reached. -n num Limit the file count (console mode only). record will stop recording after num files. -l Enable level triggered recording (console mode only) with the default trigger level (1000). -L level Enable level triggered recording with the specified trigger level. If level triggered recording is active, record will start and stop recording depending on the signal strength. Recording will be started if the signal strength is above the trigger level (1000/32768 => around 3%). Recording will be stopped if the signal is below the trigger level for some time (1.5 seconds by default, the -p switch changes this). AUTHOR
Gerd Knorr <kraxel@bytesex.org> (c) Gerd Knorr record(1)
All times are GMT -4. The time now is 09:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy