Sponsored Content
Top Forums Shell Programming and Scripting script to tail file; problem with awk and special characters Post 302592686 by moo72moo on Tuesday 24th of January 2012 01:42:13 PM
Old 01-24-2012
thx jean-Pierre. I added the if statement to your code to handle if log file gets truncated/rolled/etc....
Code:
Last=0 
while : do     
Line=$(wc -l < moo.txt)
    if [ $Line -lt $Last ]     
then          
Last=0     
fi
    awk "NR>$Last {p=1}p" moo.txt #pipe this to log analyzer program     
Last=$Line     
sleep 10 
done


Last edited by Franklin52; 01-25-2012 at 03:52 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/sed with special characters

i have this script that searches for a pattern. However it fails if the pattern includes some special characters. So far, it fails with the following strings: 1. -Cr 2. $Mj 3. H'412 would a sed or awk be more effective? i don't want the users to put the (\) during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies

2. Shell Programming and Scripting

Handling special characters using awk

Hi all, How do I extract a value without special characters? I need to extract the value of %Used from below and if its greater than 80, need to send a notification. I am doing this right now..Its giving 17%..Is there a way to extract the value and assign it to a variable in one step? df |grep... (3 Replies)
Discussion started by: sam_78_nyc
3 Replies

3. HP-UX

utf-8, problem with special characters

Hi all, We are facing the following problem in our HP-UX machine: software that manipulates utf-8 encoded strings (e.g. during string cut), fails to correctly manipulate strings (all containing Greek characters) that contain special characters like @, &, # etc. Actually, in different... (3 Replies)
Discussion started by: alina
3 Replies

4. Shell Programming and Scripting

special characters giving problem

Hi All, I have a CSV file in which some fields contains special character for ex:- my file is file 1 cat file1 abcd,bgfht,ngbht,abvc **** hdlld,hsgdt,bhfy,knht **** whenever i am trying to put a 4th feild in a variable its giving me list of all the files i have in current... (6 Replies)
Discussion started by: sam25
6 Replies

5. Shell Programming and Scripting

awk print $1 escape all special characters

I'm using awk '{print $1}' and it works most of the time to print the contents of a mysql query loop, but occationally I get a field with some special character in it, is there a way to tell awk to ignore all special characters between my FS? I have >186K records, so building a list of ALL special... (6 Replies)
Discussion started by: unclecameron
6 Replies

6. Shell Programming and Scripting

Need HELP with AWK split. Need to check for "special characters" in string before splitting the file

Hi Experts. I'm stuck with the below AWK code where i'm trying to move the records containing any special characters in the last field to a bad file. awk -F, '{if ($NF ~ /^|^/) print >"goodfile";else print >"badfile"}' filename sample data 1,abc,def,1234,A * 2,bed,dec,342,* A ... (6 Replies)
Discussion started by: shell_boy23
6 Replies

7. Shell Programming and Scripting

Problem with Special characters in file

Hi, I am facing a below problem. Inorder to mak sure the below file is fixed width i am using the following command awk '{printf("%-375s\n", $0) } so as to add trailing spaces at the end for records of length less than 375. Input file > inp.txt 1©1234 1234 123©1 The output file is... (1 Reply)
Discussion started by: marcus_kosaman
1 Replies

8. Shell Programming and Scripting

Problem with special characters....

grep -i "$line,$opline" COMBO_JUNK|awk -F, ' { C4+=$4 } { } END { print C4 } ' OFS=,` when i run this command in the script.... it o/p all the value as 0 if $line contains any special parameters..... but the same script if i run in command prompt... it shows... (4 Replies)
Discussion started by: nikhil jain
4 Replies

9. Shell Programming and Scripting

awk conditions failing (special characters?)

This is really frustrating because I can't figure it out. I'm running a health check script. One of the items I'm checking is the amount of memory on a server. I use the free command, which outputs something like this (excerpt) Mem: 100 100 100 100 Swap: 100 100 100 100 In my debugging... (5 Replies)
Discussion started by: JustaDude
5 Replies

10. Shell Programming and Scripting

Handle special characters in awk -F

Hello Folks, Need to bisect strings based on a subset. Below works good. echo /a/b/c/d | awk -F"/c/d$" '{print $1}' /a/b However, it goes awry with special characters. echo /a/b/c+/d | awk -F"/c+/d$" '{print $1}' /a/b/c+/d Desired output: /a/b Escaping the special characters... (11 Replies)
Discussion started by: vibhor_agarwali
11 Replies
POE::Filter::IRCD(3pm)					User Contributed Perl Documentation				    POE::Filter::IRCD(3pm)

NAME
POE::Filter::IRCD - A POE-based parser for the IRC protocol. SYNOPSIS
use POE::Filter::IRCD; my $filter = POE::Filter::IRCD->new( debug => 1, colonify => 0 ); my $arrayref = $filter->get( [ $hashref ] ); my $arrayref2 = $filter->put( $arrayref ); use POE qw(Filter::Stackable Filter::Line Filter::IRCD); my ($filter) = POE::Filter::Stackable->new(); $filter->push( POE::Filter::Line->new( InputRegexp => '15?12', OutputLiteral => "1512" ), POE::Filter::IRCD->new(), ); DESCRIPTION
POE::Filter::IRCD provides a convenient way of parsing and creating IRC protocol lines. It provides the parsing engine for POE::Component::Server::IRC and POE::Component::IRC. A standalone version exists as Parse::IRC. CONSTRUCTOR
"new" Creates a new POE::Filter::IRCD object. Takes two optional arguments: 'debug', which will print all lines received to STDERR; 'colonify', set to 1 to force the filter to always colonify the last param passed in a put(), default is 0. See below for more detail. METHODS
"get_one_start" "get_one" "get_pending" "get" Takes an arrayref which is contains lines of IRC formatted input. Returns an arrayref of hashrefs which represents the lines. The hashref contains the following fields: prefix command params ( this is an arrayref ) raw_line For example, if the filter receives the following line, the following hashref is produced: LINE: ':moo.server.net 001 lamebot :Welcome to the IRC network lamebot' HASHREF: { prefix => ':moo.server.net', command => '001', params => [ 'lamebot', 'Welcome to the IRC network lamebot' ], raw_line => ':moo.server.net 001 lamebot :Welcome to the IRC network lamebot', } "put" Takes an arrayref containing hashrefs of IRC data and returns an arrayref containing IRC formatted lines. Optionally, one can specify 'colonify' to override the global colonification option. eg. $hashref = { command => 'PRIVMSG', prefix => 'FooBar!foobar@foobar.com', params => [ '#foobar', 'boo!' ], colonify => 1, # Override the global colonify option for this record only. }; $filter->put( [ $hashref ] ); "clone" Makes a copy of the filter, and clears the copy's buffer. "debug" With a true or false argument, enables or disables debug output respectively. Without an argument the behaviour is to toggle the debug status. MAINTAINER
Chris Williams <chris@bingosnet.co.uk> AUTHOR
Jonathan Steinert LICENSE
Copyright X Chris Williams and Jonathan Steinert This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details. SEE ALSO
POE POE::Filter POE::Filter::Stackable POE::Component::Server::IRC POE::Component::IRC Parse::IRC perl v5.10.1 2009-12-11 POE::Filter::IRCD(3pm)
All times are GMT -4. The time now is 03:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy