I have tried few things with this but it did not help much.
I have some 200,000 files in a directory. There are two sets of files.
1. Files with extension .dat with file names like these (1.dat, 2.dat, 5.dat, 8.dat....200000.dat)
2. Another set of files with .txt extension and names like (1.txt, 2.txt, 5.txt, 8.txt.....200000.txt)
As you can see for every .dat with number there is a corresponding .txt...that is 1.dat has 1.txt, 2.dat has 2.txt and this thing goes on.
.dat files look like this:
For example, 1.dat
1.txt file look like this:
Another thing is that the number of lines in 1.dat and 1.txt are all same too.
What I need to do is to multiple the corresponding FILES with corresponding numbers in each file and store the result in .mul file. That is, multiply numbers present in 1.txt with 1.dat line by line and store the result in 1.mul and same thing goes for 2.txt and 2.dat with creating of 2.mul.
This is what I need to do in order to create 1.mul
So, my 1.mul will have
This is how I do for every file.
Now, the problem that I am facing is that my file numbers are not in continuity. As you can see after 2.dat; 5.dat comes in. So, my script breaks.
I am trying to do this:
First I paste values together:
Then I multiply the numbers like this:
But I believe I am using unnecessary disk space by creating .common files. I am working on Linux with BASH.
Well, thanks. Though it is still creating files like 3.mul, 4.mul for which no 3.dat or 3.txt exists but I can do with that. I just have to remove those zero length files with this command:
Hi
I would like to know how can I multiply the value of column three to columns 4-end of file
example of input file:
rs1000012 AK8 2 0.05 0.05 1 0 0
rs10000154 PAQR3 0.01 2 1 2 2 1
Desired output file:
rs1000012 AK8 ... (1 Reply)
the following is used to add numbers:
echo 7 47 47 44 4 3 3 3 3 3 | awk '{ for(i=1; i<=NF;i++) j+=$i; print j; j=0 }'
how do i multiply OR subtract a row of numbers using the above tactic? (8 Replies)
Hi Everyone !
I have two files with the same configuration
and I want to multiply corresponding values and write the result in a file.
Let say 2 header lines and then lines of values (with not constant number of columns):
more file1.txt -->
BLABLABLA
BLABLABLA
1 2 3 4
1 2 3
1 2
1... (7 Replies)
HI help
i have
cc 9+37.50 328611.50 688498.25 42.38
cc 66+62.50 328636.50 688498.42 42.58
i want to make o/p
cc 9+3750 328611.50 688498.25 42.38
cc 66+6250 328636.50 688498.42 42.58
plz help (2 Replies)
I have some 100 files with extension .tmp The files are named as 1.tmp, 2.tmp, 3.tmp until 100.tmp
All files look like this:
0.38701788 1.968068e-02
0.38622013 2.054002e-02
0.38350296 1.715522e-02
0.38282126 1.781283e-02
0.38282126 1.781283e-02
0.35847232 1.026839e-02
0.3557739... (7 Replies)
Hi,
I need to multiply 3rd column (comma seperated) of entire file by a value say 2.2.
Suppose the file is:
C,Gas $ YTD(TRI),15512.36,01/01/2010
New file should be (3rd column value multiplied by 2.2):
C,Gas $ YTD(TRI),34127.192,01/01/2010 (5 Replies)
All I want to do is find 5!.
read num
num={1..5}
while
do
f=
done
echo f
Error Msg. line 5: ${1..5} bad substitution
line 6: integer expression expected
Line 5 is the num=...
Line 6 is the "while" statement
I am new at this, and I am really, really trying.
Please... (14 Replies)
I have no idea about programming, just know some simple html :confused:and I need to get to somebody that can help me with creating the application (?) that will multiply 2 varibales and given price (height x lenght) x $$$.
PLEASE HELP!:confused:
edit by bakunin: Anita, as much as we... (2 Replies)
I need to multiply the value of a variable and then store it in another variable. I have EXPHOURINSEC=$(($EXPDATEHOUR * 3600)) but i get an error saying the * is unexpected.
Im using ksh (4 Replies)
Hi,
I'm need to do some addition and multiplication of scientific nottaion numbers, in the form 34.23423e-10 for example.
I was echoing the list of numbers to stdout, then using bc -l, then I find that this does not seem to work for numbers with exponential notation. Could someone help me out... (1 Reply)