That was a step in the right direction. Actually if I run the command with the example files as I posted in the example it works without any problems. I must have oversimplified my data because when I run it on the real thing the result file is huge, 2,3 GB although the source file are less than 100 Kb altogether. I tried to open with openoffice and in the preview window before importing I can see that there is a column with the file name which is great, then some stuff gets scrambled and repeated.
Here is a sample code of one file:
As you can see one column contains an "abstract", the file may have all sort of special characters, could that have been the cause why it didnt work?
Thank you again for your help, really appreciated!
Hi,
I have file1.txt and file2.txt and would like to create file3.txt based on one column in UNIX
Eg:
file1.txt
17328756,0000786623.pdf,0000786623
20115537,0000793892.pdf,0000793892
file2.txt
12521_74_4.zip,0000786623.pdf
12521_15_5.zip,0000793892.pdf
Desired Output
... (5 Replies)
Hi,
I have different files of the same type, as:
Time:
100
snr:
88
perf:
10
other:
222
Each of these files are created periodically.
What I need to do is to merge all of them into one but having the following form: (2 Replies)
Hi all,
I have a list of xml file. I need to split the files to a different files when see the <ko> tag.
The list of filename are
B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml
B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml
B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml
... (3 Replies)
SHELL SCRIPT
Hi,
I have 3 separate files within a folder. Every File contains data in a single column like
File1 contains data
mayank
sushant
dheeraj
File2 contains
DSA_AT
MG_AT
FLAT_09
File3 contains data
123123
232323 (2 Replies)
Hi,
I created a list with 2 columns.
Each line is from a different file. I am getting these with a loop in Perl. I would like to add a 3rd column with the name of the file that the line is coming from.
I usually use pr to print the filename but this is not working here ... I was wondering if... (5 Replies)
Hi,
I need to create a .csv file from information that i have in two different tab delimited .txt file. I just want to select some of the columns of each .txt file and paste them into a .cvs file.
My files look like:
File 1
transcript_id Seq. Description Seq. Length ... (2 Replies)
Hello
Below is my requirement
I have 3 files A1.txt , A2.txt and A3.txt . A2 is dynamically generating file
I want the merge of A1,A2 and A3 in A2.txt
Could you please help? (3 Replies)
Hi, I am newbie in shell script.
I need your help to solve my problem.
Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file.
File1:
SourceFile,DateTimeOriginal
/home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Hi all,
I have two separate csv files(comma delimited) file 1 and file 2.
File 1 contains
PAN,NAME,Salary
AAAAA5467D,Raj,50000
AAFAC5467D,Ram,60000
BDCFA5677D,Kumar,90000
File 2 contains
PAN,NAME,Dept,Salary
ASDFG6756T,Karthik,ABC,450000
QWERT8765Y,JAX,CDR,780000... (5 Replies)
I am trying to merge all csv files from source path into one single csv file in target. but getting error message:
hadoop fs -cat /user/hive/warehouse/stage.db/PK_CLOUD_CHARGE/TCH-charge_*.csv > /user/hive/warehouse/stage.db/PK_CLOUD_CHARGE/final/TCH_pb_charge.csv
getting error message:... (0 Replies)
Discussion started by: cplusplus1
0 Replies
LEARN ABOUT DEBIAN
number::fraction
Number::Fraction(3pm) User Contributed Perl Documentation Number::Fraction(3pm)NAME
Number::Fraction - Perl extension to model fractions
SYNOPSIS
use Number::Fraction;
my $f1 = Number::Fraction->new(1, 2);
my $f2 = Number::Fraction->new('1/2');
my $f3 = Number::Fraction->new($f1); # clone
my $f4 = Number::Fraction->new; # 0/1
or
use Number::Fraction ':constants';
my $f1 = '1/2';
my $f2 = $f1;
my $one = $f1 + $f2;
my $half = $one - $f1;
print $half; # prints '1/2'
ABSTRACT
Number::Fraction is a Perl module which allows you to work with fractions in your Perl programs.
DESCRIPTION
Number::Fraction allows you to work with fractions (i.e. rational numbers) in your Perl programs in a very natural way.
It was originally written as a demonstration of the techniques of overloading.
If you use the module in your program in the usual way
use Number::Fraction;
you can then create fraction objects using "Number::Fraction-"new> in a number of ways.
my $f1 = Number::Fraction->new(1, 2);
creates a fraction with a numerator of 1 and a denominator of 2.
my $f2 = Number::Fraction->new('1/2');
does the same thing but from a string constant.
my $f3 = Number::Fraction->new($f1);
makes $f3 a copy of $f1
my $f4 = Number::Fraction->new; # 0/1
creates a fraction with a denominator of 0 and a numerator of 1.
If you use the alterative syntax of
use Number::Fraction ':constants';
then Number::Fraction will automatically create fraction objects from string constants in your program. Any time your program contains a
string constant of the form "d+/d+" then that will be automatically replaced with the equivalent fraction object. For example
my $f1 = '1/2';
Having created fraction objects you can manipulate them using most of the normal mathematical operations.
my $one = $f1 + $f2;
my $half = $one - $f1;
Additionally, whenever a fraction object is evaluated in a string context, it will return a string in the format x/y. When a fraction
object is evaluated in a numerical context, it will return a floating point representation of its value.
Fraction objects will always "normalise" themselves. That is, if you create a fraction of '2/4', it will silently be converted to '1/2'.
Experimental Support for Exponentiation
Version 1.13 of Number::Fraction adds experimental support for exponentiation operations. If a Number::Fraction object is used as the left
hand operand of an exponentiation expression then the value returned will be another Number::Fraction object - if that makes sense. In all
other cases, the expression returns a real number.
Currently this only works if the right hand operand is an integer (or a Number::Fraction object that has a denominator of 1). Later I hope
to extend this so support so that a Number::Fraction object is returned whenever the result of the expression is a rational number.
For example:
'1/2' ** 2 # Returns a Number::Fraction ('1/4')
'2/1' ** '2/1' Returns a Number::Fraction ('4/1')
'2/1' ** '1/2' Returns a real number (1.414213)
0.5 ** '2/1' Returns a real number (0.25)
METHODS
import
Called when module is "use"d. Use to optionally install constant handler.
unimport
Be a good citizen and uninstall constant handler when caller uses "no Number::Fraction".
new
Constructor for Number::Fraction object. Takes the following kinds of parameters:
o A single Number::Fraction object which is cloned.
o A string in the form 'x/y' where x and y are integers. x is used as the numerator and y is used as the denominator of the new object.
o Two integers which are used as the numerator and denominator of the new object.
o A single integer which is used as the numerator of the the new object. The denominator is set to 1.
o No arguments, in which case a numerator of 0 and a denominator of 1 are used.
Returns "undef" if a Number::Fraction object can't be created.
to_string
Returns a string representation of the fraction in the form "numerator/denominator".
to_num
Returns a numeric representation of the fraction by calculating the sum numerator/denominator. Normal caveats about the precision of
floating point numbers apply.
add
Add a value to a fraction object and return a new object representing the result of the calculation.
The first parameter is a fraction object. The second parameter is either another fraction object or a number.
mult
Multiply a fraction object by a value and return a new object representing the result of the calculation.
The first parameter is a fraction object. The second parameter is either another fraction object or a number.
subtract
Subtract a value from a fraction object and return a new object representing the result of the calculation.
The first parameter is a fraction object. The second parameter is either another fraction object or a number.
div
Divide a fraction object by a value and return a new object representing the result of the calculation.
The first parameter is a fraction object. The second parameter is either another fraction object or a number.
exp
Raise a Number::Fraction object to a power.
The first argument is a number fraction object. The second argument is another Number::Fraction object or a number. If the second argument
is an integer or a Number::Fraction object containing an integer then the value returned is a Number::Fraction object, otherwise the value
returned is a real number.
abs
Returns a copy of the given object with both the numerator and denominator changed to positive values.
EXPORT
None by default.
SEE ALSO
perldoc overload
AUTHOR
Dave Cross, <dave@mag-sol.com>
COPYRIGHT AND LICENSE
Copyright 2002-8 by Dave Cross
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2011-11-26 Number::Fraction(3pm)