Sponsored Content
Top Forums Shell Programming and Scripting Find and awk with today's date Post 302932601 by Chubler_XL on Thursday 22nd of January 2015 05:45:22 PM
Old 01-22-2015
Here is a solution that displays the count of lines containing "NS Primary Error" within all files containing "2015-01-22":

Code:
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0  -exec awk '
    function pa() { if(FN) print FN":"CNT }
    FNR==1{pa(); FN=CNT=x }
    /2015-01-22/ {FN=FILENAME}
    /NS Primary Error/{CNT++}
    END{pa()}' '{}' '+'

 

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
PSTAT(1M)																 PSTAT(1M)

NAME
pstat - print system facts SYNOPSIS
pstat [ -aixptuf ] [ suboptions ] [ file ] DESCRIPTION
Pstat interprets the contents of certain system tables. If file is given, the tables are sought there, otherwise in /dev/mem. The required namelist is taken from /unix. Options are -a Under -p, describe all process slots rather than just active ones. -i Print the inode table with the these headings: LOC The core location of this table entry. FLAGS Miscellaneous state variables encoded thus: L locked U update time filsys(5)) must be corrected A access time must be corrected M file system is mounted here W wanted by another process (L flag is on) T contains a text file C changed time must be corrected CNT Number of open file table entries for this inode. DEV Major and minor device number of file system in which this inode resides. INO I-number within the device. MODE Mode bits, see chmod(2). NLK Number of links to this inode. UID User ID of owner. SIZ/DEV Number of bytes in an ordinary file, or major and minor device of special file. -x Print the text table with these headings: LOC The core location of this table entry. FLAGS Miscellaneous state variables encoded thus: T ptrace(2) in effect W text not yet written on swap device L loading in progress K locked w wanted (L flag is on) DADDR Disk address in swap, measured in multiples of 512 bytes. CADDR Core address, measured in multiples of 64 bytes. SIZE Size of text segment, measured in multiples of 64 bytes. IPTR Core location of corresponding inode. CNT Number of processes using this text segment. CCNT Number of processes in core using this text segment. -p Print process table for active processes with these headings: LOC The core location of this table entry. S Run state encoded thus: 0 no process 1 waiting for some event 3 runnable 4 being created 5 being terminated 6 stopped under trace F Miscellaneous state variables, or-ed together: 01 loaded 02 the scheduler process 04 locked 010 swapped out 020 traced 040 used in tracing 0100 locked in by lock(2). PRI Scheduling priority, see nice(2). SIGNAL Signals received (signals 1-16 coded in bits 0-15), UID Real user ID. TIM Time resident in seconds; times over 127 coded as 127. CPU Weighted integral of CPU time, for scheduler. NI Nice level, see nice(2). PGRP Process number of root of process group (the opener of the controlling terminal). PID The process ID number. PPID The process ID of parent process. ADDR If in core, the physical address of the `u-area' of the process measured in multiples of 64 bytes. If swapped out, the position in the swap area measured in multiples of 512 bytes. SIZE Size of process image in multiples of 64 bytes. WCHAN Wait channel number of a waiting process. LINK Link pointer in list of runnable processes. TEXTP If text is pure, pointer to location of text table entry. CLKT Countdown for alarm(2) measured in seconds. -t Print table for terminals (only DH11 and DL11 handled) with these headings: RAW Number of characters in raw input queue. CAN Number of characters in canonicalized input queue. OUT Number of characters in putput queue. MODE See tty(4). ADDR Physical device address. DEL Number of delimiters (newlines) in canonicalized input queue. COL Calculated column position of terminal. STATE Miscellaneous state variables encoded thus: W waiting for open to complete O open S has special (output) start routine C carrier is on B busy doing output A process is awaiting output X open for exclusive use H hangup on close PGRP Process group for which this is controlling terminal. -u print information about a user process; the next argument is its address as given by ps(1). The process must be in main memory, or the file used can be a core image and the address 0. -f Print the open file table with these headings: LOC The core location of this table entry. FLG Miscellaneous state variables encoded thus: R open for reading W open for writing P pipe CNT Number of processes that know this open file. INO The location of the inode table entry for this file. OFFS The file offset, see lseek(2). FILES
/unix namelist /dev/mem default source of tables SEE ALSO
ps(1), stat(2), filsys(5) K. Thompson, UNIX Implementation PSTAT(1M)
All times are GMT -4. The time now is 09:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy