Excution Problems with loading huge data content and convert it


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Excution Problems with loading huge data content and convert it
# 8  
Old 09-26-2010
Hi Summer,

If my referral data is look like this:
Code:
CGTGCF
PEOGDKGJDGKL
DFGDSFIODU
FSDOSOJSIODFJ
DSFSDFFJFOSF
SDFOSDIOP
.
.

I planned to replace those variable referral data length content to "X" based on its respectively length.
Input data:
Code:
>sample_1
SDFDSKLPEOGDKGJDGKLDSFAS

>sample_2
SDFOSDIOPDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL
.
.

Desired output:
Code:
>sample_1
SDFDSKLXXXXXXXXXXXXDSFAS

>sample_2
XXXXXXXXXDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL
.
.

Thanks again for your advice.
# 9  
Old 09-27-2010
Code:
awk '
NR==FNR {t=$0;gsub(/./,"x");a[t]=$0;next}
{
        for (i in a) if ($0~i) sub(i,a[i])
}1
' referral.data input.data

>sample_1
SDFDSKLxxxxxxxxxxxxDSFAS

>sample_2
xxxxxxxxxDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL

This User Gave Thanks to rdcwayx For This Post:
# 10  
Old 09-28-2010
Thanks again and a lot, rdcwayx Smilie
You are expert in awk language ^^
Do you familiar how to replace all the lines content to "X" based on the threshold of "X" in one line?
eg. If the output file that generated by your awk script got continuous X more than 10. I plan to replace the all lines with X at this time.
Code:
awk '
NR==FNR {t=$0;gsub(/./,"x");a[t]=$0;next}
{
        for (i in a) if ($0~i) sub(i,a[i])
}1
' referral.data input.data

>sample_1
SDFDSKLxxxxxxxxxxxxD
xxxxxxxxxDSUFSDFDSFS

>sample_2
xxxxxxxxxDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL

By your script, it shown that sample_1 got 12 continuous x in its content which above my threshold limit (>=10) of continuous x in a line.
My desired output will look like this at this moment:
Code:
>sample_1
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxDSUFSDFDSFS

>sample_2
xxxxxxxxxDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL

Thanks again, rdcwayx Smilie
# 11  
Old 09-28-2010
Code:
cat infile

>sample_1
SDFDSKLxxxxxxxxxxxxD
xxxxxxxxxDSUFSDFDSFS

>sample_2
xxxxxxxxxDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL

awk -F "x" 'NF>10 {gsub(/./,FS)}1' infile

>sample_1
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxDSUFSDFDSFS

>sample_2
xxxxxxxxxDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL

# 12  
Old 09-29-2010
Hi rdcwayx,

If my referral data (3560 different referral data) and input data (around 20MB) is very huge, do you got any better solution to improve the performance of replace the data based on referral data?
Thanks first Smilie
Quote:
Originally Posted by rdcwayx
Code:
awk '
NR==FNR {t=$0;gsub(/./,"x");a[t]=$0;next}
{
        for (i in a) if ($0~i) sub(i,a[i])
}1
' referral.data input.data

>sample_1
SDFDSKLxxxxxxxxxxxxDSFAS

>sample_2
xxxxxxxxxDSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL

# 13  
Old 09-29-2010
split the input data files to small files, and run the same awk command in different console.

then attach them again.

Code:
split input.data ABC

nohup awk -f command.awk referral.data ABCaa >ABCaa.data &
nohup awk -f command.awk referral.data ABCab >ABCab.data &


Last edited by rdcwayx; 09-29-2010 at 09:14 AM..
This User Gave Thanks to rdcwayx For This Post:
# 14  
Old 09-30-2010
Thanks a lot, rdcwayx Smilie
Can I ask you what is the meaning of "nohup"?
Is it also a command?
Thanks ^^

---------- Post updated at 01:54 AM ---------- Previous update was at 01:41 AM ----------

Hi rdcwayx,
I Just suddenly think one situation that needs your advice.
referral data
Code:
CGTGCF
PEOGDKGJDGKL
DFGDSFIODU
.

Input data:
Code:
>sample_1
ADSADAFEFGEGERPEOGDK
GJDGKLASDSFDFE
.
.

You got any idea to generate the output result as below:
Code:
ADSADAFEFGEGERXXXXXX
XXXXXXASDSFDFE
.

Thanks again ya.
Just think that this case might be more sticky when replaced the referral data with "X".
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Aggregation of huge data

Hi Friends, I have a file with sample amount data as follows: -89990.3456 8788798.990000128 55109787.20 -12455558989.90876 I need to exclude the '-' symbol in order to treat all values as an absolute one and then I need to sum up.The record count is around 1 million. How... (8 Replies)
Discussion started by: Ravichander
8 Replies

2. Shell Programming and Scripting

Extract few content from a huge list of files

I have a huge list of files (about 300,000) which have a pattern like this. .I 1 .U 87049087 .S Am J Emerg .M Allied Health Personnel/*; Electric Countershock/*; .T Refibrillation managed by EMT-Ds: .P ARTICLE. .W Some patients converted from ventricular fibrillation to organized... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

3. Shell Programming and Scripting

File Content Loading to Oracle Error

I habe a UNIX Variablw with content as below: WHOLE_REC_TXT="$record" where $record contains contents of file Sample contents of file: topic_id|1624|AIDS-HIV|| topic_id|1625|Allergies|| topic_id|1626|Alzheimer s|| topic_id|1627|Knee Pain|| topic_id|1628|Autism||... (2 Replies)
Discussion started by: Arun Mishra
2 Replies

4. Shell Programming and Scripting

convert huge .xml file in .csv with specific column.

I have huge xml file in server and i want to convert it to .csv with specific column ... i have search in blog but i didn't get any usefully command. Thanks in advance (1 Reply)
Discussion started by: pareshkp
1 Replies

5. Programming

Loading Data in shared memory (C++)

I'll try to keep this short, but basically I need to figure out a way to load data in shared memory (this file will be called load.c) I will later access the data with a print.c program. The "data" is in the form of a student database that looks like this John Blakeman 111223333 560... (7 Replies)
Discussion started by: Mercfh
7 Replies

6. Shell Programming and Scripting

Execution Problems with scan and change file data content

Input file >Read_1 XXXXXXXXXXSDFXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXAXXXXGXXA . . Desired output file >Read_1 XXXXXXXXXXXXXXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXXXXXXXXXA . . (5 Replies)
Discussion started by: patrick87
5 Replies

7. UNIX for Advanced & Expert Users

creating data loading script

asdfasdfasdfasdf??? (2 Replies)
Discussion started by: noorm
2 Replies

8. UNIX for Dummies Questions & Answers

data is seen as NULL after loading into database

hello, when I load a data from text file all the values become NULL in the table. Please help me with this problem. Thanks sheen (15 Replies)
Discussion started by: sheen
15 Replies

9. Shell Programming and Scripting

Problem of Data Loading....

i am studying a script which is used for data loading. it has functions which deletes all the existing data before loading and then loads new fresh data. but i am stuck up at function Replace into table ( col 1,col 2....) Does this signify All Inserts. (1 Reply)
Discussion started by: ankitgupta
1 Replies

10. Linux

courier-authlib problems loading libmysqlclient.so.14 and libcourierauthcommon.so.0

I am having problems with mysql authentication using courier-authlib (authdaemond). This is getting really frustrating. The error I am getting is: Aug 28 17:48:48 www authdaemond: modules="authmysql", daemons=5 Aug 28 17:48:48 www authdaemond: Installing libauthmysql Aug 28 17:48:48 www... (0 Replies)
Discussion started by: msilvers
0 Replies
Login or Register to Ask a Question