Sponsored Content
Full Discussion: Grep Script
Top Forums Shell Programming and Scripting Grep Script Post 303003476 by Con592 on Thursday 14th of September 2017 08:58:38 AM
Old 09-14-2017
Hi,
Thanks for the info.


How can I get more info from the find output, for example modified date etc in the output?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

grep from a script...

This is an extract from a script that i am trying to run. for tim in "2005:00:" "2005:01:" "2005:02:" "2005:03:" "2005:04:" "2005:05:"; do FormString="$tim" echo "grep '$FormString' access.10Aug-1201AM" count=`grep "$FormString" access.10Aug-1201AM | wc -l` ... (1 Reply)
Discussion started by: hamsasal
1 Replies

2. UNIX for Dummies Questions & Answers

grep script

hi guys, i was hoping you could help me out with the following im designing a help site for my work colleagues and would like a little script which would do a grep to check if an application is running on unix for example this is what i do on unix ps -ef | grep mqm and this tells me if... (4 Replies)
Discussion started by: drchris
4 Replies

3. Shell Programming and Scripting

Grep within a script

Hi, I am new to this - I have a unix command (below) that I would like to make automated. I would like the script to run the below command line but would like user input for '\' and '\' as these values will change depending on what i'm searching for. Is this possible? if so please help. ... (13 Replies)
Discussion started by: dnash
13 Replies

4. UNIX for Dummies Questions & Answers

trying to grep the first few lines of a continuos script, and exit the script anyidea

Hi. I am trying to extract the output of the first few lines of a continuos sh script. The when i run it, i wont to grep the the first 20 lines of it for an entry and basically do a crtl z out of it or to that effect, and output the results to a text file. I basically want to script... (5 Replies)
Discussion started by: k00061804
5 Replies

5. Shell Programming and Scripting

How to grep sql error in shell script and exit the script?

I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts. Here is my script #!/bin/csh -f source .orapass set user = $USER set pass = $PASS cd /opt/data/scripts echo... (2 Replies)
Discussion started by: allinshell99
2 Replies

6. Shell Programming and Scripting

script use min resource ( grep grep)

Hi i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it, this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this... (8 Replies)
Discussion started by: pooyair
8 Replies

7. UNIX for Dummies Questions & Answers

grep IP script

Hello, I have a command and would like to make that as a script. How do I do that? my command is: grep -Eo +\.+\.+\.+. and i want to have that like grepscript.sh x.txt > IP.txt Can somebody help me? (3 Replies)
Discussion started by: eightball
3 Replies

8. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

9. Shell Programming and Scripting

Help with script - GREP

Hallo gentlemen, i've a problem removing lines from txt file. To make it simple, here is an example: TEXT1.TXT --- contents: 9.9.9.9 geek.net 1.1.1.1 geek.com 2.2.2.2 leet.net TEXT2.TXT --- contents: geek.com coolbar.org I simply do: cat text1.txt | grep -f text2.txt >... (7 Replies)
Discussion started by: mirkocosta
7 Replies

10. UNIX for Beginners Questions & Answers

Grep within script

Hi, I found script which compare ciphers with openssl and return back all result in "YES" (for matching) and "NO" (for no match) I want to result only "YES" part which can be achieved using grep but not sure how and where to place in below script" Script:... (1 Reply)
Discussion started by: khuharshree
1 Replies
POE::Filter::Grep(3pm)					User Contributed Perl Documentation				    POE::Filter::Grep(3pm)

NAME
POE::Filter::Grep - select or remove items based on simple rules SYNOPSIS
#!perl use POE qw( Wheel::FollowTail Filter::Line Filter::Grep Filter::Stackable ); POE::Session->create( inline_states => { _start => sub { my $parse_input_as_lines = POE::Filter::Line->new(); my $select_sudo_log_lines = POE::Filter::Grep->new( Put => sub { 1 }, Get => sub { my $input = shift; return $input =~ /sudo[d+]/i; }, ); my $filter_stack = POE::Filter::Stackable->new( Filters => [ $parse_input_as_lines, # first on get, last on put $select_sudo_log_lines, # first on put, last on get ] ); $_[HEAP]{tailor} = POE::Wheel::FollowTail->new( Filename => "/var/log/system.log", InputEvent => "got_log_line", Filter => $filter_stack, ); }, got_log_line => sub { print "Log: $_[ARG0] "; } } ); POE::Kernel->run(); exit; DESCRIPTION
POE::Filter::Grep selects or removes items based on simple tests. It may be used to filter input, output, or both. This filter is named and modeled after Perl's built-in grep() function. POE::Filter::Grep is designed to be combined with other filters through POE::Filter::Stackable. In the "SYNOPSIS" example, a filter stack is created to parse logs as lines and remove all entries that don't pertain to a sudo process. (Or if your glass is half full, the stack only selects entries that DO mention sudo.) PUBLIC FILTER METHODS
In addition to the usual POE::Filter methods, POE::Filter::Grep also supports the following. new new() constructs a new POE::Filter::Grep object. It must either be called with a single Code parameter, or both a Put and a Get parameter. The values for Code, Put, and Get are code references that, when invoked, return true to select an item or false to reject it. A Code function will be used for both input and output, while Get and Put functions allow input and output to be filtered in different ways. The item in question will be passed as the function's sole parameter. sub reject_bidoofs { my $pokemon = shift; return 1 if $pokemon ne "bidoof"; return; } my $gotta_catch_nearly_all = POE::Filter::Grep->new( Code => &reject_bidoofs, ); Enforce read-only behavior: my $read_only = POE::Filter::Grep->new( Get => sub { 1 }, Put => sub { 0 }, ); modify modify() changes a POE::Filter::Grep object's behavior at run-time. It accepts the same parameters as new(), and it replaces the existing tests with new ones. # Don't give away our Dialgas. $gotta_catch_nearly_all->modify( Get => sub { 1 }, Put => sub { return shift() ne "dialga" }, ); SEE ALSO
POE::Filter for more information about filters in general. POE::Filter::Stackable for more details on stacking filters. BUGS
None known. AUTHORS &; COPYRIGHTS The Grep filter was contributed by Dieter Pearcey. Documentation is provided by Rocco Caputo. Please see the POE manpage for more information about authors and contributors. perl v5.14.2 2012-05-15 POE::Filter::Grep(3pm)
All times are GMT -4. The time now is 08:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy