Hello,
This porblem bugged me for some time. It is to merge different files of hundred rows to have a union with the ID as key column (kind of similar to join!) and absence with 0.
I want the output as
I search the site that there some posts about merge two files, by a common column, but my case is different. I tried my code which is working but the output lost some of the information
The output is:
I know there is a bug with the algorithm, e.g. D in File1, when reading File2, D is supposed to be saved as:
and when reading File3, it should be saved as:
But it was skipped because it is not in File2 or File3. The fact seems only the new "KEY" of the hash is properly added, and the existing KEY not listed in latter files (File2 or File3) will be skipped.
How to fix this bug? I met in my work occasionally, and seems a common job similar to join but different. Hope there is command like "union" for this job (leave all the 0 with NA!, my wish though!)
Thanks a lot in advance!
Use associative array is easier to check a specified key is exists or not.
Since the format of your files are the same, duplicating the code for each file is not a good idea. I prefer using command line arguments to pass the filenames and loop through them. That is run the command likes this:
Hi Folks -
I'm encountering an issue:
Scenario:
We have automated GL data loads utilizing FDMEE. The problem is that some of our Locations could have multiple files. I think we are running into a situation where the script is trying to name the 2 files the same name and it is bombing out.... (8 Replies)
Hello,
Im using the g++(g++ Ubuntu/Linaro 4.4.4-14ubuntu5 4.4.5) and im trying to compile a small snippet code and got into an endless loop.I recompiled that in VS2010 under Windows 7 and the answer is as expected.so i wonder is this a bug of g++?here is my code.
#include<iostream>
using... (5 Replies)
#!/bin/bash
if then
#echo "infinite loop"
exit 0
fi
when I run this file I get the following error:
./test_infinite_loop: line 5: syntax error near unexpected token `fi'
./test_infinite_loop: line 5: `fi'
:confused: (4 Replies)
This single line of code in a sh script file
top -b -n 1 -U $USER
causes the script to prematurely exit with an exit code of 1 (i.e. an error) if the script is run with the -e option (e.g. if
set -e
is executed near the top of the script file).
Alternatively, you can execute it like
top... (8 Replies)
Hi All,
I am using Red Hat Linux on my servers. The problem that I am facing is, sometimes the /opt usage on the server shows used percentage as 100% , when actually it is simply 20%.
When I reboot the system, it comes back to 20%.Is this a bug in the system or my settings have gone wrong... (1 Reply)
I have done a script and IT WORKS JUST PERFECT from command line...but in cron it has problems executing...
nawk -F"|" '
{ s=substr($104,2,18)}
{b ++s}
END { for (i in b) print i, b } ' $1 > /path/to/files/TranId_w$2
q=`cat /path/to/files/TranId_w$2 | wc -l`
echo $q >... (1 Reply)