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
# 1  
Old 09-22-2010
Excution Problems with loading huge data content and convert it

Hi,

I got long list of referred file content:
Code:
CGTGCFTGCGTFREDG
PEOGDKGJDGKLJGKL
DFGDSFIODUFIODSUF
FSDOFJSODIFJSIODFJ
DSFSDFDFSDOFJFOSF
SDFOSDJFOJFPPIPIOP
.
.
.

Input file content:
Code:
>sample_1
SDFDSKLFKDSLSDFSDFDFGDSFIODUFIODSUFSDDSFDSSDFDSFAS

>sample_2
DFDFGDSFIODUFIODSUFSDFDSFSDFOSDJFOJFPPIPIOPTPHHPHLHL
.
.

Desired output:
Code:
>sample_1
SDFDSKLFKDSLSDFSDFXXXXXXXXXXXXXXXSDDSFDSSDFDSFAS

>sample_2
DFXXXXXXXXXXXXXXXSDFDSFXXXXXXXXXXXXXXXTPHHPHLHL
.
.

My main purpose is convert the input file's content that same like the content in referred file into "XXXXXXXXXXXXXXX" and written into an output file.
Thanks for any advice or suggestion.
# 2  
Old 09-22-2010
You have your requirement defined ...

But what is the problem ? You want us to give solution to you or you have some solution with issues ?!

I would suggest you to solve using perl, if you know perl already.
# 3  
Old 09-22-2010
Quote:
Originally Posted by thegeek
You have your requirement defined ...

But what is the problem ? You want us to give solution to you or you have some solution with issues ?!

I would suggest you to solve using perl, if you know perl already.
Hi thegeek,
I got try to use the sed command.
Code:
sed 's/DFGDSFIODUFIODSUF/XXXXXXXXXXXXXXX/g' input file > output file

But it seems like sed command is not worked well when deal which huge data Smilie
Do you got better suggestion by using perl script to archive my goal?
Thanks for any advice.
# 4  
Old 09-23-2010
So what's the problem by sed?

Code:
cat reference.txt

CGTGCFTGCGTFREDG
PEOGDKGJDGKLJGKL
DFGDSFIODUFIODSUF
FSDOFJSODIFJSIODFJ
DSFSDFDFSDOFJFOSF
SDFOSDJFOJFPPIPIOP

for i in $(cat reference.txt)
do
  sed -i "s/$i/XXXXXXXXXXXXXXX/g" input      # if your sed don't support -i option, replace by below perl command
# or
  perl -i -pe  "s/$i/XXXXXXXXXXXXXXX/g" input 
done

This User Gave Thanks to rdcwayx For This Post:
# 5  
Old 09-23-2010
Hi rdcwayx,

Thanks for your suggestion. It is worked Smilie
But it seems like not worked if my input my sequence content is like:
Code:
problem 1:
>sample_10
TRAAERASDDSDSTERTRTRTERTEDFGDSFIODU
FIODSUFASDSDASFSAFEDFFDFDFDFDFDFDA
.
.

It seems like I needed to remove the newline (\n) in the content before start doing the conversion, am I right?
Sed command that I try previously worked as well.
Just it takes time when loading for huge data convert Smilie
Thanks again my advice ya Smilie
Quote:
Originally Posted by rdcwayx
So what's the problem by sed?

Code:
cat reference.txt

CGTGCFTGCGTFREDG
PEOGDKGJDGKLJGKL
DFGDSFIODUFIODSUF
FSDOFJSODIFJSIODFJ
DSFSDFDFSDOFJFOSF
SDFOSDJFOJFPPIPIOP

for i in $(cat reference.txt)
do
  sed -i "s/$i/XXXXXXXXXXXXXXX/g" input      # if your sed don't support -i option, replace by below perl command
# or
  perl -i -pe  "s/$i/XXXXXXXXXXXXXXX/g" input 
done



---------- Post updated at 06:43 AM ---------- Previous update was at 05:47 AM ----------

Hi rdcwayx,

The command that you suggested will output the result in the same file (input file), am I right?
Besides that, if my referred file content got around 124464 reads (each reads length around 22) and the input file got around 115478631 bases, do you got any other suggestion to speed up the progress?
Thanks Smilie
# 6  
Old 09-23-2010
try below perl which is a little bit slow if your list is really long

Code:
open FH,"<listfile";
my @tmp = <FH>;
my @pat = map {s/\n//;$_} @tmp;
close FH;
open FH,"<filetobereplaced";
while(<FH>){
  my $str = $_;
  foreach my $pat (@pat){
     my $tmp = $str=~s/$pat/<>/g;
     last if $tmp > 0;
  }
  print $str;
}
close FH;

This User Gave Thanks to summer_cherry For This Post:
# 7  
Old 09-23-2010
Hi summer,

Thanks for your perl script Smilie
I'm trying it now.
My referred list got around 124464 reads. Hopefully it won't taken too long of times Smilie
Thanks again ya.
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