Sponsored Content
Operating Systems AIX Substrings and the likes in AIX 4.2 ? Post 302254088 by Franklin52 on Monday 3rd of November 2008 02:49:41 PM
Old 11-03-2008
Post an example of the log file and the desired output.

Regards
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Breaking strings into Substrings

I'm only new to shell programming and have been given a task to do a program in .sh, however I've come to a point where I'm not sure what to do. This is my code so far: # process all arguments (i.e. loop while $1 is present) while ; do # echo "Arg is $1" case $1 in -h*|-H*) echo "help... (4 Replies)
Discussion started by: switch
4 Replies

2. Shell Programming and Scripting

extracting substrings

Hi guys, I am stuck in this problem. Please help. I have two files. FILE1 (with records starting from '>' ) >TC1723_3 similar to Scific_A7Q9Q3 EMSPSQDYCDDYFKLTYPCTAGAQYYGRGALPVYWNYNYGAIGEALKLDLLNHPEYIEQN ATMAFQAAIWRWMNPMKKGQPSAHDAFVGNWKP >TC214_2 similar to Quiet_Ref100_Q8W2B2 Cluster;... (1 Reply)
Discussion started by: smriti_shridhar
1 Replies

3. What is on Your Mind?

vi/emacs against Eclipse (and the likes) as IDE

Ok, I have to ask... :o At the risk of starting a huge controversy (yet another), I must ask the question: why would one want to use vi/emacs* to edit bash, awk, perl, python, scripts or java, c/c++, programs It all started because I'm looking for a good IDE to edit my bash scripts and... (6 Replies)
Discussion started by: anthalamus
6 Replies

4. Shell Programming and Scripting

extracting substrings from variables

Hello Everyone, I am looking for a way to extract substrings to local variables. Here is the format of the string variable i am using : /var/x/www && /usr/x/share/doc && /etc/x/logs where the substrings i must extract are the "/var/x/www" and such. I was originally thinking of using... (15 Replies)
Discussion started by: jimmy75_13
15 Replies

5. Shell Programming and Scripting

Capturing first output from 'top'-likes command

Is this a stupid code?? top > top.out & sleep 2 kill %1 cat top.out Thanks, (6 Replies)
Discussion started by: Shawn, Lee
6 Replies

6. Shell Programming and Scripting

Extract three substrings from a logfile

I have a log file like below. 66.249.73.11 - - "UCiZ7QocVqYAABgwfP8AAHAA" "US" "Mediapartners-Google" "-" www.mahashwetha.com.sg "GET... (2 Replies)
Discussion started by: Tuxidow
2 Replies

7. UNIX for Dummies Questions & Answers

Replace substrings in awk

Hi ! my input looks like that: --AAA-AAAAAAA---------AA- AAA------AAAAAAAAAAAAAA ------A----AAAA-----A------- Using awk, I would need to replace only the "-" located between the last letter and the end of the string by "~" in order to get: --AAA-AAAAAAA---------AA~... (7 Replies)
Discussion started by: beca123456
7 Replies

8. Shell Programming and Scripting

Finding most common substrings

Hello, I would like to know what is the three most abundant substrings of length 6 from col2. The file is quite large and looks like this col1 col2 EN03 typehellobyedogcatcatdog EN09 typehellobyebyebyebye EN08 dogcatcatdogbyebyebyebye EN09 catcattypehellobyebyebyebye... (9 Replies)
Discussion started by: verse123
9 Replies

9. Shell Programming and Scripting

Look for substrings with special characters

Hello gurus, I have a lookup table cat tmp1 \\\erw``~ 1 ^774574574565665f\] 2 ()42543^ and I`m trying to compare a bunch of strings such that, either the lookup table column 1, or the string to be looked up are substrings of each other (and return the second lookup column if yes). ... (2 Replies)
Discussion started by: sheetalk
2 Replies
Rotate(3pm)						User Contributed Perl Documentation					       Rotate(3pm)

NAME
Logfile::Rotate - Perl module to rotate logfiles. SYNOPSIS
use Logfile::Rotate; my $log = new Logfile::Rotate( File => '/var/adm/syslog/syslog.log', Count => 7, Gzip => 'lib', Post => sub{ open(IN, "/var/run/syslog.pid"); kill("HUP", chomp(<IN>)); } Dir => '/var/log/old', Flock => 'yes', Persist => 'yes', ); # process log file $log->rotate(); or my $log = new Logfile::Rotate( File => '/var/adm/syslog', Gzip => '/usr/local/bin/gzip'); # process log file $log->rotate(); undef $log; DESCRIPTION
I have used the name space of Logfile::Base package by Ulrich Pfeifer, as the use of this module closely relates to the processing log- files. new "new" accepts the following arguments, "File", "Count", "Gzip", "Pre", "Post", "Flock" and "Dir" with only "File" being mandatory. "new" will open and lock the file, so you may co-ordinate the processing of the file with rotating it. The file is closed and unlocked when the object is destroyed, so you can do this explicitly by "undef"'ing the object. The "Pre"/"Post" arguments allow you to pass function references to this method, which you may use as a callback for any processing you want before or after the rotation. For example, you may notify the process writing to the file that it has been rotated. The "Pre" function is passed the current filename to be rotated as an argument and the "Post" function is passed the current filename that was rotated and that file's new filename including any extension added by compression previously. Both the "Pre" and "Post" function references you provide are executed within an "eval" statement inside the "rotate" method. If the "eval" returns an error then the "rotate" method will croak at that point. The "Signal" argument is deprecated by the "Post" argument. The "Flock" argument allows you to specify whether the perl function "flock" is used to lock the file during the rotation operation. Apparently flock causes problems on some platforms and this option has been added to allow you to control the programs behaviour. By default the file will be locked using "flock". The "Persist" argument allows you to control whether the program will try and set the current log file ownership and permissions on any new files that may be created by the rotation. In some circumstances the program doing the file rotation may not have sufficient per- mission to "chown" on the file. By default the program will try and preserve ownership and permissions. rotate() This method will copy the file passed in "new" to a file of the same name, with a numeric extension and truncate the original file to zero length. The numeric extension will range from 1 up to the value specified by Count, or 7 if none is defined, with 1 being the most recent file. When Count is reached, the older file is discarded in a FIFO (first in, first out) fashion. If the argument "Dir" was given, all old files will be placed in the specified directory. The "Post" function is the last step executed by the rotate method so the return code of rotate will be the return code of the function you proved, or 1 by default. The copy function is implemented by using the File::Copy package, but I have had a few people suggest that they would prefer File::Move. I'm still not decided on this as you would loose data if the move should fail. Optional Compression If available "rotate" will also compress the file with the gzip program or the program passed as the "Gzip" argument. You may now also use "lib" as a value for the "Gzip" argument. This directs the program to load the "Compress::Zlib" module, if available and use it do the compression within perl. This avoids the security issues associated with spawning external programs and is the recom- mended value for this option. If no argument is defined it will first check to see if the "Compress::Zlib" module can be loaded then check the perl Config to determine if gzip is available on your system. In this case the gzip must be in your current path to succeed, and accept the "-f" option. See the "WARNING" section below. Optional Relocation Directory If you specify an argument for "Dir" then the file being rotated will be relocated to the directory specified. Along with any other files that may have been rotated previously. If the directory name specified does not exist then it will be created with 0750 permissions. If you wish to have other permissions on the directory then I would recommend you create the directory before using this module. See the "WARNING" section below. WARNING
If a system call is made to gzip this makes this module vulnerable to security problems if a rogue gzip is in your path or gzip has been sabotaged. For this reason a STRONGLY RECOMMEND you DO NOT use this module while you are ROOT. For a more secure alternative install the "Compress::Zlib" module and use the lib value for the "Gzip" argument. If you specify an argument for "Dir" and the directory name you pass does not exist, this module will create the directory with permissions 0750. DEPENDANCIES
See File::Copy. If "Gzip" is being used it must create files with an extension of ".gz" for the file to be picked by the rotate cycle. COPYRIGHT
Copyright (c) 1997-99 Paul Gampe. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSI- BILITY OF SUCH DAMAGE. THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN ``AS IS'' BASIS, AND THE AUTHORS AND DISTRIBU- TORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. SEE ALSO
File::Copy, Logfile::Base, flock Changes file for change history and credits for contributions. RETURN
All functions return 1 on success, 0 on failure. AUTHOR
Paul Gampe <paulg@apnic.net> perl v5.8.8 2000-08-29 Rotate(3pm)
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy