Sponsored Content
Top Forums Shell Programming and Scripting Display lines of two date range from syslog file Post 302831255 by DGPickett on Wednesday 10th of July 2013 03:01:15 PM
Old 07-10-2013
You could preprocess the dates into YYYY-M-DD form (or whatever) and use that script.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

get Message from file within date range

Hi All, I am a java devloper putting my hands on shell scripts. Honestly it sounds coool and interesting Presently I got stuck with the following requirement. Get the messages from file. The messages in the file are as follows: date|message1 date|message2 . . . date is of... (2 Replies)
Discussion started by: ambharish
2 Replies

2. UNIX for Dummies Questions & Answers

How to display files that have been modifed between a given date range

Hi, I am new to Unix and was trying different ways of how to display the list of file names modified between a given date range in sorting order.I will get the fromdate and Todate from the browser, I need to display the list of all the file names that are modified between the given date... (1 Reply)
Discussion started by: prathima
1 Replies

3. Shell Programming and Scripting

retrieve lines from file which fall under the given date range

Hi, I need to retrieve the lines which fall under the given date range. eg:In a log file,i have the lines which will have the timestamp. the input will be some date range.eg: from date:03/Jan/2008,to date:24/Jul/2008.so now i want to retrieve the lines which have the timestamp between these... (5 Replies)
Discussion started by: Sharmila_P
5 Replies

4. Shell Programming and Scripting

display the file with in the date range

Hi All, I want a shell script which can display the file with in the date range. For Example I have 15 files with the following format abc_01-01-2009.txt to abc_15-01-2009.txt. Now I want to have the files between 4th of jan to 12th files. How can I acheive this. Advance... (1 Reply)
Discussion started by: fareed_do
1 Replies

5. UNIX for Dummies Questions & Answers

Display dates within a given date range

Hi All, I have a requirement to display all the dates within the provided (through user input) date range. For eg: If I enter 28012009 (as From date in the format 'DDMMYYYY') and 02022009(as To date in the format 'DDMMYYYY'), the output should be all dates occuring between the from and to... (11 Replies)
Discussion started by: sunpraveen
11 Replies

6. Shell Programming and Scripting

Retrieve lines from a file in a given date range

Hey, guys! I am trying to retrieve lines from a file in a given date range. I tried using sed -n "/${SDATE}/,/${EDATE}/p" ~/webhits/$FILE | wc -l but that doesn't work if the starting or the end date do not match exactly. If both dates match, there are no problems (for example 25 March 2008 -... (5 Replies)
Discussion started by: oopcho
5 Replies

7. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

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

9. UNIX for Dummies Questions & Answers

Display lines after match is found within specified range

I have a file which has collection of segments occuring n(For eg.100) times ISA GS ST NM1*85 N3 N4 NM1*IL N3 N4 REF*D9*1001 ISE GE SE ISA GS ST NM1*85 N3 (13 Replies)
Discussion started by: nsuresh316
13 Replies

10. UNIX for Dummies Questions & Answers

How to display lines by range specified?

My input file is N3*123 ABC FLATS~ REF*D9*10000000001~ N3*223 ABC FLATS~ REF*D9*10000000002~ N3*323 ABC FLATS~ REF*D9*10000000003~ N3*423 ABC FLATS~ REF*D9*10000000004~ N3*523 ABC FLATS~ REF*D9*10000000005~ N3*623 ABC FLATS~ REF*D9*10000000006~ N3*723 ABC FLATS~ REF*D9*10000000007~ N3*823... (2 Replies)
Discussion started by: nsuresh316
2 Replies
PREPROCESS(1)						      General Commands Manual						     PREPROCESS(1)

NAME
preprocess - Preprocess a file. SYNOPSIS
preprocess [options...] infile DESCRIPTION
Preprocess is like a typical C preprocessor, but it extends to multiple languages. Languages for which it works include: C++, Python, Perl, Tcl, XML, JavaScript, CSS, IDL, TeX, Fortran, PHP, Java, Shell scripts (Bash, CSH, etc.) and C#. Preprocess is usable both as a command line app and as a Python module. OPTIONS
-h, --help Print help text and exit. -V, --version Print the version info and exit. -v, --verbose Give verbose output for errors. -o outfile Write output to the given file instead of to stdout. -f, --force Overwrite given output file. Otherwise an IOError will be raised if outfile already exists. -D define Define a variable for preprocessing. define can simply be a variable name (in which case it will be true) or it can be of the form var=val. An attempt will be made to convert val to an integer so "-D FOO=0" will create a false value. -I dir Add a directory to the include path for #include directives. -k, --keep-lines Emit empty lines for preprocessor statement lines and skipped output lines. This allows line numbers to stay constant. -s, --substitute Substitute defines into emitted lines. By default substitution is NOT done because it currently will substitute into program strings. MODULE USAGE
from preprocess import preprocess preprocess(infile, outfile=sys.stdout, defines={}, force=0, keepLines=0, includePath=[], substitute=0) The <infile> can be marked up with special preprocessor statement lines of the form: <comment-prefix> <preprocessor-statement> <comment-suffix> where the <comment-prefix/suffix> are the native comment delimiters for that file type. EXAMPLES
HTML (*.htm, *.html) or XML (*.xml, *.kpf, *.xul) files: <!-- #if FOO --> ... <!-- #endif --> Python (*.py), Perl (*.pl), Tcl (*.tcl), Ruby (*.rb), Bash (*.sh), or make ([Mm]akefile*) files: # #if defined('FAV_COLOR') and FAV_COLOR == "blue" ... # #elif FAV_COLOR == "red" ... # #else ... # #endif C (*.c, *.h), C++ (*.cpp, *.cxx, *.cc, *.h, *.hpp, *.hxx, *.hh), Java (*.java), PHP (*.php) or C# (*.cs) files: // #define FAV_COLOR 'blue' ... /* #ifndef FAV_COLOR */ ... // #endif Fortran 77 (*.f) or 90/95 (*.f90) files: C #if COEFF == 'var' ... C #endif PREPROCESSOR SYNTAX
Valid statements: #define <var> [<value>] #undef <var> #ifdef <var> #ifndef <var> #if <expr> #elif <expr> #else #endif #error <error string> #include "<file>" where <expr> is any valid Python expression. The expression after #if/elif may be a Python statement. It is an error to refer to a variable that has not been defined by a -D option or by an in-content #define. Special built-in methods for expressions: defined(varName) Return true if given variable is defined. TIPS
A suggested file naming convention is to let input files to preprocess be of the form <basename>.p.<ext> and direct the output of prepro- cess to <basename>.<ext>, e.g.: preprocess -o foo.py foo.p.py The advantage is that other tools (esp. editors) will still recognize the unpreprocessed file as the original language. AUTHORS
Trent Mick <trentm@gmail.com> This manual page was written by Johannes Ring <johannr@simula.no> for the Debian GNU/Linux system (but may be used by others). PREPROCESS(1)
All times are GMT -4. The time now is 08:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy