03-27-2013
Thanks alot for the code you provided.
This code worked fine.
Thanks again for your help.
Venkat
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to unix and would greatly appreciate some help.
I have a file containing multiple colums containing different sets of data e.g.
File 1:
John Ireland 27_December_69
Mary England 13_March_55
Mike France 02_June_80
I am currently using the awk... (10 Replies)
Discussion started by: crunchie
10 Replies
2. Shell Programming and Scripting
I'm trying to combine colums from multiple file to a single file but having some issues, appreciate your help.
The filenames are the same except for the extension,
path1.m0
---------
a b c
d e f
g h i
path1.m1
---------
m n o
p q r
s t u
File names are path1.m
The... (3 Replies)
Discussion started by: rkmca
3 Replies
3. Programming
Hi All
I need a small help for the below format in making a small script in Perl or Shell.
I have a file in which a single line entries are broken into three line entries.
Eg:
I have a
pen and
notebook.
All i want is to capture in a single line in a separate file.
eg: I have a pen and... (4 Replies)
Discussion started by: Kalaiela
4 Replies
4. Shell Programming and Scripting
Hi,
Input
7488 7389 chr1.fa chr1.fa
3546 9887 chr5.fa chr9.fa
7387 7898 chrX.fa chr3.fa
7488 7389 chr21.fa chr3.fa
7488 7389 chr1.fa chr1.fa
3546 9887 chr9.fa chr5.fa
7898 7387 chrX.fa chr3.fa
Desired Output
7488 7389 chr1.fa chr1.fa 2
3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies
5. UNIX for Dummies Questions & Answers
:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux.
I am working in Linux terminal.
I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies
6. Shell Programming and Scripting
Hi All,
I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd.
What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies
7. Shell Programming and Scripting
Hi,
I have multiple files that each contain one column of strings:
File1:
123abc
456def
789ghi
File2:
123abc
456def
891jkl
File3:
234mno
123abc
456def
In total I have 25 of these type of file. (5 Replies)
Discussion started by: owwow14
5 Replies
8. Shell Programming and Scripting
I would like to join two files when two columns in each file matches with each other and then produce an output when taking multiple columns.
Like I have file A
1234,ABCD,23,JOHN,NJ,USA
2345,ABCD,24,SAM,NY,USA
5678,GHIJ,24,TOM,NY,USA
5678,WXYZ,27,MAT,NJ,USA
and file B
... (2 Replies)
Discussion started by: mady135
2 Replies
9. Shell Programming and Scripting
Hello Unix gurus,
I have a large number of files (say X) each containing two columns of data and the same number of rows.
I would like to combine these files to create a unique merged file containing X columns corresponding to the second column of each file (with a bonus of having the first... (3 Replies)
Discussion started by: ksennin
3 Replies
10. UNIX for Beginners Questions & Answers
I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this.
--- Post updated at... (5 Replies)
Discussion started by: Kentlee65
5 Replies
LEARN ABOUT OSX
universal::require
UNIVERSAL::require(3) User Contributed Perl Documentation UNIVERSAL::require(3)
NAME
UNIVERSAL::require - require() modules from a variable
SYNOPSIS
# This only needs to be said once in your program.
require UNIVERSAL::require;
# Same as "require Some::Module"
my $module = 'Some::Module';
$module->require or die $@;
# Same as "use Some::Module"
BEGIN { $module->use or die $@ }
DESCRIPTION
If you've ever had to do this...
eval "require $module";
to get around the bareword caveats on require(), this module is for you. It creates a universal require() class method that will work with
every Perl module and its secure. So instead of doing some arcane eval() work, you can do this:
$module->require;
It doesn't save you much typing, but it'll make alot more sense to someone who's not a ninth level Perl acolyte.
Methods
require
my $return_val = $module->require or die $@;
my $return_val = $module->require($version) or die $@;
This works exactly like Perl's require, except without the bareword restriction, and it doesn't die. Since require() is placed in the
UNIVERSAL namespace, it will work on any module. You just have to use UNIVERSAL::require somewhere in your code.
Should the module require fail, or not be a high enough $version, it will simply return false and not die. The error will be in $@ as well
as $UNIVERSAL::require::ERROR.
$module->require or die $@;
use
my $require_return = $module->use or die $@;
my $require_return = $module->use(@imports) or die $@;
Like "UNIVERSAL::require", this allows you to "use" a $module without having to eval to work around the bareword requirement. It returns
the same as require.
Should either the require or the import fail it will return false. The error will be in $@.
If possible, call this inside a BEGIN block to emulate a normal "use" as closely as possible.
BEGIN { $module->use }
SECURITY NOTES
UNIVERSAL::require makes use of "eval STRING". In previous versions of UNIVERSAL::require it was discovered that one could craft a class
name which would result in code being executed. This hole has been closed. The only variables now exposed to "eval STRING" are the
caller's package, filename and line which are not tainted.
UNIVERSAL::require is taint clean.
COPYRIGHT
Copyright 2001, 2005 by Michael G Schwern <schwern@pobox.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
AUTHOR
Michael G Schwern <schwern@pobox.com>
SEE ALSO
Module::Load, "require" in perlfunc, <http://dev.perl.org/rfc/253.pod>
perl v5.16.2 2009-03-30 UNIVERSAL::require(3)