Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Search for Multiple strings in a given date range and print the Group if they exists Post 303040204 by Neo on Thursday 24th of October 2019 11:37:42 PM
Old 10-25-2019
Please be specific and clearly state the exact strings you wish to match; and also post your desired output exactly.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need to print file names in a certain date range using ls

I need to list only file names of a specific date from the command ls -lt. :confused: (2 Replies)
Discussion started by: Shamwari
2 Replies

2. Shell Programming and Scripting

Search files between a date range

Hi people A newbie here, thrown into the deep end. I want to select the group of files with in a range of dates and perform some operation on it. Are there inbuild date libraries i can use? I did read thru the old posts on this topic. Couldnt get much idea :(, basically want to know how I... (7 Replies)
Discussion started by: zcanji
7 Replies

3. Shell Programming and Scripting

Search multiple Strings in a File

Hi I want to search multiple strings in a file . But the search should start with "From" Keyword and end with before "Where" keyword. Please suggest me. Thanks (2 Replies)
Discussion started by: sboss
2 Replies

4. Shell Programming and Scripting

Search, group , print count

hi All, need help. have a file like below A, error in 123 B, log files are present A, error in 23444 B, log files are present A, move to next line C, matching messages -- expected output-- A , count =2 , error in * A , count =1 , move to next line B , count =2 , log files are present... (2 Replies)
Discussion started by: arun1401
2 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

Search on date range of file based on user input

Hello I would like to ask for help with a script to search a directory that contains many log files and based on a users input after being prompted, they enter a date range down to the hour which searches the files that contain that range. I dont know how to go about this. I am hoping that the... (5 Replies)
Discussion started by: lostincashe
5 Replies

7. Shell Programming and Scripting

awk strings search + print next column after match

Hi, I have a file filled with search strings which have a blank in between and look like this: S. g. Ehr. o. Jg. v. d. Chijs g. Ehr. Now i would like to search for the strings and it also shall return the next column after the match. awk -v FILE="search_strings.txt" 'BEGIN {... (10 Replies)
Discussion started by: sdf
10 Replies

8. Shell Programming and Scripting

Search & Replace: Multiple Strings / Multiple Files

I have a list of files all over a file system e.g. /home/1/foo/bar.x /www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g. if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc. There... (2 Replies)
Discussion started by: spacegoose
2 Replies

9. Shell Programming and Scripting

Search between two search strings and print the value

Based on the forums i have tried with grep command but i am unable to get the required output. search this value /*------ If that is found then search for temp_vul and print and also search until /*------- and print new_vul Input file contains: ... (5 Replies)
Discussion started by: onesuri
5 Replies

10. UNIX for Dummies Questions & Answers

Search file and print everything except multiple search terms

I'm trying to find a way to search a range of similar words in a file. I tried using sed but can't get it right:sed 's/\(ca01\)*//'It only removes "ca01" but leaves the rest of the word. I still want the rest of the information on the lines just not these specific words listed below. Any... (3 Replies)
Discussion started by: seekryts15
3 Replies
DelimMatch(3pm) 					User Contributed Perl Documentation					   DelimMatch(3pm)

NAME
Text::DelimMatch - Perl extension to find regexp delimited strings with proper nesting SYNOPSIS
use Text::DelimMatch; $mc = new Text::DelimMatch, $startdelim, $enddelim; $mc->quote('"'); $mc->escape("\"); $mc->double_escape('"'); $mc->case_sensitive(1); ($prefix, $match, $remainder) = $mc->match($string); ($prefix, $nextmatch, $remainder) = $mc->match(); $middle = $mc->strip_delim($match); # returns $match w/o start and end delim DESCRIPTION
These routines allow you to match delimited substrings in a buffer. The delimiters can be specified with any regular expression and the start and end delimiters need not be the same. If the delimited text is properly nested, entire nested groups are returned. In addition, you may specify quoting and escaping characters that contribute to the recognition of start and end delimiters. For example, if you specify the start and end delimiters as '(' and ')', respectively, and the double quote character as a quoting character, and the backslash as an escaping character, then the delimited substring in this buffer is "(ma(t)c)h)": 'prefix text "(quoted text)" (escaped " text) (ma(t)c)h) postfix text' In order to support this rather complex interface, the matching context is encapsulated in an object. The object, Text::DelimMatch, has the following public methods: new $start, $end, $escape, $dblesc, $qs1, $qe1, ... $qsn, $qen Creates a new object. All of the arguments are optional, and can be set with other methods, but they must be passed in the specified order: start delimiter, end delimiter, escape characters, double escape characters, and a set of quote characters. match $string In an array context, returns ($pre, $match, $post) where $pre is the text preceding the first match, $match is the matched text (including the delimiters), and $post is the rest of the text in the buffer. In a scalar context, returns $match. If $string is not provided on subsequent calls, the $post from the previous match is used, unless keep is false. If keep is false, the match always fails. strip_delim $string Returns $string with the start and end delimiters removed. delim $start, $end Set the start and end delimiters. Only one set of delimiters can be in use at any one time. Returns the delimters in use before this call. quote $startq, $endq Specifies the start and end quote characters. Multiple quote character pairs are supported, so this function is additive. To clear the current settings, pass no arguments, e.g., $mc->quote(). If only $start is passed, $end is assumed to be the same. In matching, quotes occur in pairs. In other words, if (",") and (',') are both specified as quote pairs and a string beginning with " is found, it is ended only by another ", not by '. Returns the quote hash in use before this call. escape $esc Specifies a set of escaping characters. This can only be a string of characters. $esc can be a regexp set or a simple string. If it is a simple string, it will be translated into the regexp set "[ quotemeta($esc) ]". Returns the escape characters in use before this call. double_escape $esc Specifies a set of double-escaping characters, i.e., characters that are considered escaped if they occur in pairs. For example, in some languages, 'Don''t you see?' defines a string containing a single apostrophe. $esc can only be a string of characters. $esc can be a regexp set or a simple string. If it is a simple string, it will be translated into the regexp set "[ quotemeta($esc) ]". Returns the double-escaping characters in use before this call. case_sensitive $bool Sets case sensitivity to $bool or true if $bool is not specified. Returns the case sensitivity in use before this call. keep $bool Sets keep to $bool or true if $bool is not specified. Keep, which is true by default, specifies whether or not the matching context object keeps a local copy of the buffer used in matching. Keeping a local copy allows repeated matching on the same buffer, but might be a bad idea if the buffer is a terabyte long. ;-) Returns the keep setting in use before this call. returndelim $bool Sets returndelim to $bool or true if $bool is not specified. Returndelim, which is true by default, specifies whether or not the start and end delimiters are returned with the matching string. Returns the returndelim setting in use before this call. error $seterr Returns the last error that occured. If $seterr is passed, the error is set to that value. Some common kinds of bad input are detected and an error condition is raised. If an error condition is raised, all matching fails until the error is cleared. The most common error is a bad regular expression, for example specifing the start delimiter as "(" instead of "\(". Remember, these are regexps! pre_matched Returns the prefix text from the last match if keep is true. Sets an error and returns an empty string if keep is false. matched Returns the matched text from the last match if keep is true. Sets an error and returns an empty string if keep is false. post_matched Returns the postfix text from the last match if keep is true. Sets an error and returns an empty string if keep is false. debug $bool Sets debug to $bool or true if $bool is not specified. If debug is true, informative and progress messages are printed to STDOUT by some methods. Returns the debugging setting in use before this call. dump For debugging, prints all of the instance variables for a particular object. slow $bool For debugging. Some classes of delimited strings can be located with much faster algorithms than can be used in the most general case. If slow is true, the slower, general algorithm is always used. For simplicity, and backward compatibility with the previous (limited release) incarnation of this module, the following functions are also available directly: nested_match ($string, $start, $end, $three) If $three is true, returns ($pre, $match, $post) in an array context otherwise returns ("$pre$match", $post). In a scalar context, returns "$pre$match". skip_nested_match ($string, $start, $end, $three) If $three is true, returns ($pre, $match, $post) in an array context otherwise returns ("$pre$match", $post). In a scalar context, returns $post. EXAMPLES
$mc = new Text::DelimMatch '"'; $mc->('pre "match" post') == '"match"'; $mc->delim("\(", "\)"); $mc->('pre (match) post') == ('pre ', '(match)', ' post'); $mc->('pre (ma(t)ch) post') == ('pre ', '(ma(t)ch)', ' post'); $mc->quote('"'); $mc->escape("\"); $mc->('pre (ma")"tch) post') == ('pre ', '(ma")"tch)', ' post'); $mc->('pre (ma(t)c)h") post') == ('pre ', '(ma(t)c)h")', ' post'); See also test.pl in the distribution. AUTHOR
Norman Walsh, ndw@nwalsh.com COPYRIGHT
Copyright (C) 1997-2002 Norman Walsh. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. WARRANTY
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
perl(1). perl v5.10.0 2003-05-20 DelimMatch(3pm)
All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy