Sponsored Content
Top Forums Shell Programming and Scripting Search on date range of file based on user input Post 302616147 by lostincashe on Friday 30th of March 2012 02:32:36 PM
Old 03-30-2012
Thanks very much, I will try this when I am next at work on Monday.
I was not aware of the IFS "/" so it was interesting to read your post.
Thanks againSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Log File date compare for user defined range

:confused: Hi i am a noob and need a little help to finish my shell script. I am learning as i go but hit a problem. I am search thorugh logs(*.rv) files to find entires between two user defined dates, The script so far looks for the "START" and "END" of each entry at sees if it belongs To... (0 Replies)
Discussion started by: mojo24
0 Replies

2. Shell Programming and Scripting

Report file extraction based on Date range

Hi all, Iam writing a script, which will extract all the files from Start_Date to End_Date. Files are date stamped as YYYYMMDD. For ex: Start_Date='20051001' End_Date='20060331' extract files such as........ ramp_20050810.rpt ramp_20050915.rpt ramp_20051001.rpt ramp_20051010.rpt... (2 Replies)
Discussion started by: ganapati
2 Replies

3. Shell Programming and Scripting

search file, change existing value based on input (awk help)

I have a file (status.file) of the form: valueA 3450 valueB -20 valueC -340 valueD 48 I am tailing a data.file, and need to search and modify a value in status.file...the tail is: tail -f data.file | awk '{ print $3, ($NF - $(NF-1)) }' which will produce lines that look like this: ... (3 Replies)
Discussion started by: nortonloaf
3 Replies

4. Shell Programming and Scripting

Append file based upon user input-- solved

Ok, I have a script with a commandline option that allows the user to add a custom function to the script file. I have tried everything in my limited knowledge of sed to get this to work and keep coming up short. I need sed to search for a line starting with a pattern, I've got that part so far,... (0 Replies)
Discussion started by: DC Slick
0 Replies

5. Shell Programming and Scripting

Search for a specific data in a file based on a date range

Hi, Currently I am working on a script to automate the process of converting the log file from binary into text format. To achieve this, partly I am depending on my application’s utility for this conversion and the rest I am relying on shell commands to search for directory, locate the file and... (5 Replies)
Discussion started by: svajhala
5 Replies

6. Shell Programming and Scripting

display Range of date depend on user input php

Hi, i am very new to php Is it possible to display Range of date depend on user input day example: user input 2 day start from 28/4/12 it will add 2 day from date of input so display should look like this 28/4/12 to 30/4/12 then from 30/412 user add another 4 date so will... (0 Replies)
Discussion started by: guidely
0 Replies

7. UNIX for Advanced & Expert Users

Help with ksh script to list, then cp files from a user input date range

Hi, I'm quite new to ksh scripting, can someone help me with this. Requirements: I need to create a script that list the files from a user input date range. e. g. format of file: *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00*... (1 Reply)
Discussion started by: chococrunch6
1 Replies

8. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

9. Shell Programming and Scripting

Bash to search file based off user input then create new file

In the below bash a file is downloaded when the program is opened and then that file is searched based on user input and the result is written to a new file. For example, the bash is opened and the download.txt is downloaded, the user then enters the id (NA04520). The id is used to search... (5 Replies)
Discussion started by: cmccabe
5 Replies

10. Shell Programming and Scripting

awk command to search based on 5 user input fields

Field1=”” Field2=”” Field3=”” Field4=”” Field5=”” USER INPUT UP TO 5 FIELDS awk -F , '{ if ( $3 == Field1 && $6 == Field2 && $8 == Field3 && $9 == Field4 && $10 == Field5) print $0 }' /tmp/rodney.outD INPUT FILE (Rodney.outD): ... (3 Replies)
Discussion started by: rmerrird
3 Replies
AUSEARCH:(8)						  System Administration Utilities					      AUSEARCH:(8)

NAME
ausearch - a tool to query audit daemon logs SYNOPSIS
ausearch [options] DESCRIPTION
ausearch is a tool that can query the audit daemon logs based for events based on different search criteria. The ausearch utility can also take input from stdin as long as the input is the raw log data. Each commandline option given forms an "and" statement. For example, searching with -m and -ui means return events that have both the requested type and match the user id given. An exception is the -n option; multiple nodes are allowed in a search which will return any matching node. It should also be noted that each syscall excursion from user space into the kernel and back into user space has one event ID that is unique. Any auditable event that is triggered during this trip share this ID so that they may be correlated. Different parts of the kernel may add supplemental records. For example, an audit event on the syscall "open" will also cause the kernel to emit a PATH record with the file name. The ausearch utility will present all records that make up one event together. This could mean that even though you search for a specific kind of record, the resulting events may contain SYSCALL records. Also be aware that not all record types have the requested information. For example, a PATH record does not have a hostname or a loginuid. OPTIONS
-a, --event audit-event-id Search for an event based on the given event ID. Messages always start with something like msg=audit(1116360555.329:2401771). The event ID is the number after the ':'. All audit events that are recorded from one application's syscall have the same audit event ID. A second syscall made by the same application will have a different event ID. This way they are unique. -c, --comm comm-name Search for an event based on the given comm name. The comm name is the executable's name from the task structure. -e, --exit exit-code-or-errno Search for an event based on the given syscall exit code or errno. -f, --file file-name Search for an event based on the given filename. -ga, --gid-all all-group-id Search for an event with either effective group ID or group ID matching the given group ID. -ge, --gid-effective effective-group-id Search for an event with the given effective group ID or group name. -gi, --gid group-id Search for an event with the given group ID or group name. -h, --help Help -hn, --host host-name Search for an event with the given host name. The hostname can be either a hostname, fully qualified domain name, or numeric network address. No attempt is made to resolve numeric addresses to domain names or aliases. -i, --interpret Interpret numeric entities into text. For example, uid is converted to account name. The conversion is done using the current resources of the machine where the search is being run. If you have renamed the accounts, or don't have the same accounts on your machine, you could get misleading results. -if, --input file-name Use the given file instead of the logs. This is to aid analysis where the logs have been moved to another machine or only part of a log was saved. --input-logs Use the log file location from auditd.conf as input for searching. This is needed if you are using ausearch from a cron job. --just-one Stop after emitting the first event that matches the search criteria. -k, --key key-string Search for an event based on the given key string. -l, --line-buffered Flush output on every line. Most useful when stdout is connected to a pipe and the default block buffering strategy is undesirable. May impose a performance penalty. -m, --message message-type | comma-sep-message-type-list Search for an event matching the given message type. You may also enter a comma separated list of message types. There is an ALL message type that doesn't exist in the actual logs. It allows you to get all messages in the system. The list of valid messages types is long. The program will display the list whenever no message type is passed with this parameter. The message type can be either text or numeric. If you enter a list, there can be only commas and no spaces separating the list. -n, --node node-name Search for events originating from node name string. Multiple nodes are allowed, and if any nodes match, the event is matched. -o, --object SE-Linux-context-string Search for event with tcontext (object) matching the string. -p, --pid process-id Search for an event matching the given process ID. -pp, --ppid parent-process-id Search for an event matching the given parent process ID. -r, --raw Output is completely unformatted. This is useful for extracting records that can still be interpretted by audit tools. -sc, --syscall syscall-name-or-value Search for an event matching the given syscall. You may either give the numeric syscall value or the syscall name. If you give the syscall name, it will use the syscall table for the machine that you are using. -se, --context SE-Linux-context-string Search for event with either scontext/subject or tcontext/object matching the string. --session Login-Session-ID Search for events matching the given Login Session ID. This process attribute is set when a user logs in and can tie any process to a particular user login. -su, --subject SE-Linux-context-string Search for event with scontext (subject) matching the string. -sv, --success success-value Search for an event matching the given success value. Legal values are yes and no. -te, --end [end-date] [end-time] Search for events with time stamps equal to or before the given end time. The format of end time depends on your locale. If the date is omitted, today is assumed. If the time is omitted, now is assumed. Use 24 hour clock time rather than AM or PM to specify time. An example date using the en_US.utf8 locale is 09/03/2009. An example of time is 18:00:00. The date format accepted is influenced by the LC_TIME environmental variab le. You may also use the word: now, recent, today, yesterday, this-week, week-ago, this-month, this-year. Today means starting now. Recent is 10 minutes ago. Yesterday is 1 second after midnight the previous day. This-week means starting 1 second after midnight on day 0 of the week determined by your locale (see localtime). This-month means 1 second after midnight on day 1 of the month. This-year means the 1 second after midnight on the first day of the first month. -ts, --start [start-date] [start-time] Search for events with time stamps equal to or after the given end time. The format of end time depends on your locale. If the date is omitted, today is assumed. If the time is omitted, midnight is assumed. Use 24 hour clock time rather than AM or PM to specify time. An example date using the en_US.utf8 locale is 09/03/2009. An example of time is 18:00:00. The date format accepted is influ- enced by the LC_TIME environmental variable. You may also use the word: now, recent, today, yesterday, this-week, this-month, this-year. Today means starting at 1 second after midnight. Recent is 10 minutes ago. Yesterday is 1 second after midnight the previous day. This-week means starting 1 second after midnight on day 0 of the week determined by your locale (see localtime). This-month means 1 second after midnight on day 1 of the month. This-year means the 1 second after midnight on the first day of the first month. -tm, --terminal terminal Search for an event matching the given terminal value. Some daemons such as cron and atd use the daemon name for the terminal. -ua, --uid-all all-user-id Search for an event with either user ID, effective user ID, or login user ID (auid) matching the given user ID. -ue, --uid-effective effective-user-id Search for an event with the given effective user ID. -ui, --uid user-id Search for an event with the given user ID. -ul, --loginuid login-id Search for an event with the given login user ID. All entry point programs that are pamified need to be configured with pam_loginuid required for the session for searching on loginuid (auid) to be accurate. -v, --version Print the version and exit -w, --word String based matches must match the whole word. This category of matches include: filename, hostname, terminal, and SE Linux con- text. -x, --executable executable Search for an event matching the given executable name. SEE ALSO
auditd(8), pam_loginuid(8). Red Hat Sept 2009 AUSEARCH:(8)
All times are GMT -4. The time now is 02:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy