Sponsored Content
Top Forums Shell Programming and Scripting Script to Search Logs Several Directories Pulling out Only Current Date Post 302608873 by agama on Sunday 18th of March 2012 11:54:37 PM
Old 03-19-2012
Having a guess without seeing the format of the files, I'd pipe the output from find into awk via xargs which will allow you to get the file name, and chop matching lines to 50 (or whatever) characters. Change the output of the date command to match the date format in your files if it's not YYYY/MM/DD.

Code:
find . -mtime -1 \( -name "*.log" -o -name "*log.0" \) | xargs awk -v IGNORECASE=1 -v cur_date="$(date "+%D")" '
    (/service failure/ || /error/ || /severe/) && match( $0, cur_date ) { printf( "%s: %s\n", FILENAME, substr( $0, 1, 50 ) ); } '



---------- Post updated at 23:54 ---------- Previous update was at 23:50 ----------

And Chubler_XL's question is valid -- if dates are not consistent, then my suggestion would need to be augmented.

Last edited by agama; 03-19-2012 at 12:53 AM.. Reason: Managed to cut service out in search regex -- put it back
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search for a file with Current Date

Hi, How can we search for a file with current date(sysdate). Actually i want the file name from a directory which was created today(current date). For example i have a dir /home/arch and i have files with name aglito03axyz.datetimestamp in this directory, but all these files were created... (7 Replies)
Discussion started by: sandeep_1105
7 Replies

2. Shell Programming and Scripting

search on weblogic logs with date time ranges 2

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log |... (1 Reply)
Discussion started by: itik
1 Replies

3. Linux

search on weblogic logs with date time ranges

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log... (1 Reply)
Discussion started by: itik
1 Replies

4. Debian

Search files that start with current date

hi all, i need to find same files in my directory that looks like this format 20121017145949639.xml (YYYYMMDD*.xml) thanks for help (3 Replies)
Discussion started by: merouan
3 Replies

5. Shell Programming and Scripting

Search for logs traced between specific date and time from log file

HI, I want to search for a logs which are trace between specific date and time from logs file. My logs are generated like this :- Tue Jun 18 05:00:02 EEST 2013 | file_check.sh| Message:script has files to process. Thu Jun 20 05:00:02 EEST 2013 | file_check.sh| Message:script has files to... (5 Replies)
Discussion started by: ketanraut
5 Replies

6. Shell Programming and Scripting

Grep a pattern in current date logs

Hello, I need to write one script which should search particular pattern like ABCD in log file name hello.txt only in current date logs. in current directory i have so many past date logs but grep should be applied on current date logs. on daily basis current date logs are in number 30 and... (2 Replies)
Discussion started by: ajju
2 Replies

7. 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

8. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies

9. 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

10. Linux

How to calculate the quarter end date according to the current date in shell script?

Hi, My question is how to calculate the quarter end date according to the current date in shell script? (2 Replies)
Discussion started by: Divya_1234
2 Replies
GWYDDION-THUMBNAILE(1)						     Gwyddion						    GWYDDION-THUMBNAILE(1)

NAME
gwyddion-thumbnailer - Create thumbnails of SPM data files SYNOPSIS
gwyddion-thumbnailer {--version | --help} gwyddion-thumbnailer [OPTION...] {MODE} [ARGUMENT...] DESCRIPTION
Gwyddion-thumbnailer creates thumbnails of SPM (Scanning Probe Microscope) image files. Depending on the mode of operation, described below, the thumbnails are written to conform to various desktop standards so that they can be displayed in nautilus(1), thunar(1) and similar file managers. Gwyddion-thumbnailer loads and renders files using gwyddion(1), libraries and modules, therefore, it can create thumbnails of all file formats supported by your Gwyddion installation. This also means it inherits Gwyddion settings, e.g. the default false color gradient, and that it is influenced by the same environment variables as Gwyddion. INFORMATIVE OPTIONS
--help Prints a brief help and terminates. --version Prints version information and terminates. THUMBNAILING OPTIONS
--update Writes the thumbnail only if it does not exist yet or does not seem to be up-to-date. By default, gwyddion-thumbnailer overwrites existing thumbnails with fresh ones even if they seem up to date. MODE
Three thumbnailing modes are available: gnome2, tms and kde4; and one special mode: check. They are described below. GNOME 2 gwyddion-thumbnailer [OPTION...] gnome2 MAX-SIZE INPUT-FILE OUTPUT-FILE In gnome2 mode, gwyddion-thumbnailer creates PNG thumbnails according to the Gnome thumbnailer specification. Usings the convention from this specification, it should be run gwyddion-thumbnailer gnome2 %s %i %o Gwyddion installs the corresponding GConf schemas and enables thumbnailers for all file types it supports by default, so usually this should Just Work and should not need to be set up manually. The thumbnails created in gnome2 more are identical as in tms mode, including all the PNG auxiliary chunks (provided that the same MAX-SIZE as in tms mode is specified, of course). TMS
gwyddion-thumbnailer [OPTION...] tms MAX-SIZE INPUT-FILE In tms mode, gwyddion-thumbnailer creates PNG thumbnails according to the Thumbnail Managing Standard. Argument MAX-SIZE must be 128 or normal (both meaning 128 pixels) or 256 or large (both meaning 256 pixels). Output file name is not given as it is prescribed by the TMS. The thumbnail is placed to the directory for normal or large thumbnails according to given MAX-SIZE. This mode can also be useful for manual batch-creation of thumbnails. For instance, to create them for all *.afm files in directory scans and its subdirectories, you can run find scans -type f -name '*.afm' -print0 \ | xargs -0 -n 1 gwyddion-thumbnailer --update tms normal And then go make yourself a coffee because this will take some time. KDE 4 gwyddion-thumbnailer kde4 MAX-SIZE INPUT-FILE In kde4 mode, gwyddion-thumbnailer creates PNG thumbnails that are intended to be consumed by gwythumbcreator KDE module. The thumbnail, again identical as in the other modes, is written to the standard output. Do not use this mode from the command line. It is documented for completness, however, the protocol between gwythumbcreator and gwyddion-thumbnailer must be considered private and it can change any time. CHECK
gwyddion-thumbnailer check INPUT-FILE The check mode does not serve for thumbnail creation. Instead, gwyddion-thumbnailer prints information about available thumbnails of INPUT-FILE and cached failures to produce a thumbnail by individual applications, as described by the TMS. If the normal-sized thumbnail exists and is up to date, the large version does not exist and there is one cached failure from gnome-thumbnail-factory, the output can be for instance: File: INPUT-FILE URI: file:///home/me/Pictures/naughty/broken-tip3/INPUT-FILE Normal: /home/me/.thumbnails/normal/MD5.png status: OK Large: /home/me/.thumbnails/large/MD5.png status: Thumbnail does not exist or stat() fails on it. Failed: /home/me/.thumbnails/fail/gnome-thumbnail-factory/MD5.png URI is the canonical URI of the input file, MD5 stands for the hex representation of MD5 sum of the URI, as described by the TMS. If there are no cached failures, no Failed lines are printed. This function can be used to check thumbnails of any kind, not necessarily created by gwyddion or gwyddion-thumbnailer. In future, it might be reported as an error if the thumbnail does not contain Gwyddion-specific information though. SEE ALSO
gwyddion(1), AUTHOR
Yeti Author. gwyddion 09/04/2009 GWYDDION-THUMBNAILE(1)
All times are GMT -4. The time now is 10:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy