02-20-2011
Hi Scrutinizer, rdcwayx
Thanks for the input guys..:-) I really appreciate it
Scrutinizer
I think the way you hacked through the string pattern was awesome...
My only question is the use of case ie the variable $4 is actually the superset of $i so Im not sure how the case $4 check actually works...it does...i tried it but isnt it like checking if a superset is present in its subset? how does that work?
eg $4 = "string1_string2_string3_string4_string5_string6_string7"
and the value of i that is the file names after the parsing are eg
$i = "string1_string2"
or $i= "string3_string4" etc...so how does the case of $4 work ?
Thanks for the solution..It works....Im just trying to understand this
rdcwayx
The solution works for the example you gave but doesnt work for the other cases....Thanks a lot though :-)
You guys are great....
I hope I can help some one like this someday.
Ruk
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I was writing a shell script for FTPing files for a machine. now i am facing a problem in it. The problem is i want to ftp files which do not end with a particular pattern. The pattern is file should not end with .dd ( d=digit )
for eg: say i have files
file
file.01
file.02
... (0 Replies)
Discussion started by: dipendra_g
0 Replies
2. Shell Programming and Scripting
Hi,
I'm wondering what is the best way to parse out a long string that has a specific deliminator and outputting each token between the delim on a newline?
i.e. input
text1,text2,text3,tex4
i.e. output
text1
text2
text3
text4 (8 Replies)
Discussion started by: primp
8 Replies
3. Shell Programming and Scripting
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies
4. Shell Programming and Scripting
Alright,
I'm new to Perl so be gentle. Given the following script:
----
open(file, "<file.txt");
@lines = <file>;
close(file);
$var = print $lines;
----
So I'm printing line 18 of the file "file.txt". I now want the 5th column, minus the forward slash. The line looks like this:
... (2 Replies)
Discussion started by: wxornot
2 Replies
5. Shell Programming and Scripting
Quick question...I'm trying to grab the .tif file name from this output from our fax server. What is the best way i can do this in a bash script? I have been looking at regular expressions with bash or using awk but having some trouble. thanks! The only output i want is... (5 Replies)
Discussion started by: kuliksco
5 Replies
6. UNIX for Dummies Questions & Answers
This should be somewhat simple, but I need some help with this one.
I have a bunch of files with tags on the end like so...
Filename {tag1}.ext
Filename2 {tag1} {tag2}.ext
I want to hold in a variable just the filename with all the " {tag}" removed. The tag can be anything so I'm looking... (4 Replies)
Discussion started by: kerppz
4 Replies
7. Shell Programming and Scripting
Hi all!
Looking for some help parsing filenames in bash. I have a directory full of files named "livingroom-110111105637.avi". The format is always date and time (yymmddhhmmss). I'm looking to parse the filenames so they are a little more easily readable. Maybe rename them to... (4 Replies)
Discussion started by: mtehonica
4 Replies
8. Shell Programming and Scripting
Hi all :)
It sounds complex, for example
I want to find the whole html file (there are 5 entries of this string and I need to get all of them) for the string
"<td class="contentheading" width="100%">", get the next line from it only till the point that says "</td>", plus removing \t (tabs)
... (6 Replies)
Discussion started by: hakermania
6 Replies
9. Shell Programming and Scripting
Hi,
I have a string which can be completely unstructred. I am looking to parse out values within that String.
Here is an example
<Random Strings> String1=<some number a> String2=<some number b> String3=<some number c> Satish=<some number d> String4=<some number e>
I only want to parse out... (1 Reply)
Discussion started by: satishrao
1 Replies
10. Shell Programming and Scripting
I have a text file like this , where the same set of three lines repeat with different values.
INFO: processing now 03/25/2015-00:06:05 03/25/2015-00:16:04
------Invoking myexe table=table1
INFO 25-03 00:20:26,801 - Finished processing (I=0, O=57, R=57, W=57, U=0, E=0)
INFO: processing... (4 Replies)
Discussion started by: Lakshmikumari
4 Replies
LEARN ABOUT REDHAT
carp::clan
CLAN(1) User Contributed Perl Documentation CLAN(1)
NAME
Carp::Clan - Report errors from perspective of caller of a "clan" of modules
SYNOPSIS
carp - warn of errors (from perspective of caller)
cluck - warn of errors with stack backtrace
croak - die of errors (from perspective of caller)
confess - die of errors with stack backtrace
use Carp::Clan qw(^MyClan::);
croak "We're outta here!";
use Carp::Clan;
confess "This is how we got here!";
DESCRIPTION
This module is based on ""Carp.pm"" from Perl 5.005_03. It has been modified to skip all package names matching the pattern given in the
"use" statement inside the ""qw()"" term (or argument list).
Suppose you have a family of modules or classes named "Pack::A", "Pack::B" and so on, and each of them uses ""Carp::Clan qw(^Pack::);"" (or
at least the one in which the error or warning gets raised).
Thus when for example your script "tool.pl" calls module "Pack::A", and module "Pack::A" calls module "Pack::B", an exception raised in
module "Pack::B" will appear to have originated in "tool.pl" where "Pack::A" was called, and not in "Pack::A" where "Pack::B" was called,
as the unmodified ""Carp.pm"" would try to make you believe ":-)".
This works similarly if "Pack::B" calls "Pack::C" where the exception is raised, etcetera.
In other words, this blames all errors in the ""Pack::*"" modules on the user of these modules, i.e., on you. ";-)"
The skipping of a clan (or family) of packages according to a pattern describing its members is necessary in cases where these modules are
not classes derived from each other (and thus when examining @ISA (as in the original ""Carp.pm"" module) doesn't help).
The purpose and advantage of this is that a "clan" of modules can work together (and call each other) and throw exceptions at various
depths down the calling hierarchy and still appear as a monolithic block (as though they were a single module) from the perspective of the
caller.
In case you just want to ward off all error messages from the module in which you ""use Carp::Clan"", i.e., if you want to make all error
messages or warnings to appear to originate from where your module was called (this is what you usually used to ""use Carp;"" for ";-)"),
instead of in your module itself (which is what you can do with a "die" or "warn" anyway), you do not need to provide a pattern, the module
will automatically provide the correct one for you.
I.e., just ""use Carp::Clan;"" without any arguments and call "carp" or "croak" as appropriate, and they will automatically defend your
module against all blames!
In other words, a pattern is only necessary if you want to make several modules (more than one) work together and appear as though they
were only one.
Forcing a Stack Trace
As a debugging aid, you can force ""Carp::Clan"" to treat a "croak" as a "confess" and a "carp" as a "cluck". In other words, force a
detailed stack trace to be given. This can be very helpful when trying to understand why, or from where, a warning or error is being gener-
ated.
This feature is enabled either by "importing" the non-existent symbol 'verbose', or by setting the global variable "$Carp::Clan::Verbose"
to a true value.
You would typically enable it by saying
use Carp::Clan qw(verbose);
Note that you can both specify a "family pattern" and the string "verbose" inside the ""qw()"" term (or argument list) of the "use" state-
ment, but consider that a pattern of packages to skip is pointless when "verbose" causes a full stack trace anyway.
BUGS
The ""Carp::Clan"" routines don't handle exception objects currently. If called with a first argument that is a reference, they simply
call ""die()"" or ""warn()"", as appropriate.
perl v5.8.0 2002-09-29 CLAN(1)