Sponsored Content
Top Forums Shell Programming and Scripting Find and awk with today's date Post 302932558 by bdby on Thursday 22nd of January 2015 12:35:24 PM
Old 01-22-2015
Find and awk with today's date

Hi All,
Solaris 10 o/s
With your help I developed the following script.
Code:
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0  -exec   egrep –c  'NS Primary Error' '{}' '+'

which returns the counts I needed nelow:
Code:
/oracle/diag/rdbms/musidp/musidp/trace/abcdef_d001_21751.trc:15
/oracle/diag/rdbms/musidp/musidp/trace/ abcdef _d000_21750.trc:20
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d001_22002.trc:1524
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d000_22001.trc:1291

There is one additional requirement and those counts can only be related to today’s date. Right now those counts include several dates in each trace file. I have come up with the following but it returns no data. I know for a fact that when I inspected the trace files I see that date 2015-01-22 in the trace file.

Code:
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0  -exec egrep  'NS Primary Error' '{}' '+' | awk '/2015-01-22/ {print}'

Is there some other way to write this
Any assistance would be appreciated.
Thanks

Last edited by vgersh99; 01-22-2015 at 01:55 PM.. Reason: code tags, please!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compare today's date with date in a file

Hi I am very new to scripting, Can someone show me how to (in unix shell script) compare the system's date with a date in a file. The requirement is to somehow open this file (which will only have a date in it) and compare it with today's date. If they are equal execute a procedure below but if... (4 Replies)
Discussion started by: siog
4 Replies

2. UNIX for Dummies Questions & Answers

Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete

Hello, I am trying to show today's date and time in a better format than ‘date' (Using positional parameters). I found a command mktime and am wondering if this is the best command to use or will this also show me the time elapse since 1/30/70? Any help would be greatly appreciated, Thanks... (3 Replies)
Discussion started by: citizencro
3 Replies

3. Shell Programming and Scripting

Find file that matches today's date in filename and move to /tmp in bash

I'm having problems with my bash script. I would like to find a file matching today's date in the filename, i.e. my_file_20120902.txt and then move it to a different directory, i.e. /tmp. Thanks. (1 Reply)
Discussion started by: jamesi
1 Replies

4. Shell Programming and Scripting

[Solved] Replace yesterday date with today's date except from the first line

Hello, I have a file like this: 2012112920121130 12345620121130msABowwiqiq 34477420121129amABamauee e7748420121130ehABeheheei in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use... (3 Replies)
Discussion started by: Lilu_CK
3 Replies

5. Shell Programming and Scripting

UNIX date fuction - how to deduct days from today's date

Hi, One of my Unix scripts needs to look for files coming in on Fridays. This script runs on Mondays. $date +"%y%m%d" will give me today's date. How can I get previous Friday's date.. can I do "today's date minus 3 days" to get Friday's date? If not, then any other way?? Name of the files is... (4 Replies)
Discussion started by: juzz4fun
4 Replies

6. Shell Programming and Scripting

Need to add a date column (today's date) in file

Hi I have file with number status and date1 and date1 field, want add a column today between column date1 and date2. file1.txt number status date1 date2 ===== ==== === ===== 34567 open 27/06/13 28/06/13 45678 open 27/06/13 28/06/13 43567 open 27/06/13 28/06/13 ... (1 Reply)
Discussion started by: vijay_rajni
1 Replies

7. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

8. Shell Programming and Scripting

Check, if date is not today

hello, in a file exist entries in date format YYYYMMDD. i want to find out, if there are dates, which isn't today's date. file: date example text 20140714 <= not today's date 20140715 <= not today's date 20140716 <= today's date my idea is to use Perderabo's datecalc ... (2 Replies)
Discussion started by: bora99
2 Replies

9. UNIX for Beginners Questions & Answers

Find and copy .zip file based on today's date

Hi Team, I'm new to unix and i have a requirement to copy or move files from one directory to another based on current date mentioned in the .zip file name. Note that i need to copy only the recent zip file. please help me with the code i tried the code as: #! /usr/bin/sh find... (3 Replies)
Discussion started by: midhun3108
3 Replies

10. UNIX for Beginners Questions & Answers

Compare Date to today's date in shell script

Hi Community! Following on from this code in another thread: #!/bin/bash file_string=`/bin/cat date.txt | /usr/bin/awk '{print $5,$4,$7,$6,$8}'` file_date=`/bin/date -d "$file_string"` file_epoch=`/bin/date -d "$file_string" +%s` now_epoch=`/bin/date +%s` if then #let... (2 Replies)
Discussion started by: Greenage
2 Replies
TAU_MERGE(1)							       Tools							      TAU_MERGE(1)

NAME
tau_merge - combine multiple node and or thread TAU tracefiles into a merged tracefile SYNOPSIS
tau_merge [-a] [-r] [-n] [-e eventfile_list] [-m output_eventfile] {tracefile_list} [{output_tracefile} { - }] DESCRIPTION
tau_merge is generated when TAU is configured with the -TRACE option. This tool assembles a set of tau trace and event files from multiple multiple nodes or threads across a program's execution into a single unified trace file. Many TAU trace file tools operate on merged trace files. Minimally, tau_merge must be invoked with a list of unmerged trace files followed by the desired name of the merged trace file or the - flag to send the output to the standard out. Typically the list can be designated by giving the shared name of the trace files to be merged followed by desired range of thread or node designators in brackets or the wild card character '*' to encompass variable thread and node designations in the filename (trace.A.B.C.trc where A, B and C are the node, context and thread numbers respectively). For example tautrace.*.trc would represent all tracefiles in a given directory while tautrace.[0-5].0.0.trc would represent the tracefiles of nodes 0 through 5 with context 0 and thread 0. tau_merge will generate the specified merged trace file and an event definition file, tau.edf by default. The event definition file can be given an alternative name by using the '-m' flag followed by the desired filename. A list of event definition files to be merged can be designated explicitly by using the '-e' flag followed by a list of unmerged .edf files, specified in the same manner as the trace file list. If computational resources are insufficient to merge all trace and event files simultaneously the process may be undertaken hierarchically. Corresponding subsets of the tracefiles and eventfiles may be merged in sequence to produce a smaller set of files that can then be to merged into a singular fully merged tracefile and eventfile. E.g. for a 100 node trace, trace sets 1-10, 11-20, ..., 91-100 could be merged into traces 1a, 2a, ..., 10a. Then 1a-10a could be merged to create a fully merged tracefile. OPTIONS
-e eventfile_list explicitly define the eventfiles to be merged -m output_eventfile explicitly name the merged eventfile to be created - send the merged tracefile to the standard out -a adjust earliest timestamp time to zero -r do not reassemble long events -n do not block waiting for new events. By default tau_merge will block and wait for new events to be appended if a tracefile is incomplete. This command allows offline merging of (potentially) incomplete tracefiles. EXAMPLES
To merge all TAU tracefiles into app.trc and produce a merged tau.edf eventfile: tau_merge *.trc app.trc To merge all eventfiles 0-255 into ev0_255merged.edf and TAU tracefiles for nodes 0-255 into the standard out: tau_merge -e events.[0-255].edf -m ev0_255merged.edf tautrace.[0-255].*.trc - To merge eventfiles 0, 5 and seven info ev057.edf and tau tracefiles for nodes 0, 5 and 7 with context and thread 0 into app.trc: tau_merge -e events.0.edf events.5.edf events.7.edf -m ev057.edf tautrace.0.0.0.trc tautrace.5.0.0.trc tautrace.7.0.0.trc app.trc SEE ALSO
tau_convert tau2profile tau2vtf tau2elg tau2slog2 12/22/2005 TAU_MERGE(1)
All times are GMT -4. The time now is 08:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy