hi..I am a perl beginner..i have this perl script which takes an input file and apply two sed commands..
#!/usr/bin/perl use Data::Dumper; use File::Copy; for( ; ; ) { my $fileexists= -e "text.out"; if ($fileexists ne "1") { `touch text.out`; foreach my $file (</data/admin/scripts/SapcmedadpebM/xdecoder/decodedi +r/MHSAPC/*csv>) { chomp; $abc1=`find $file -mmin +10`; chomp($abc1); if ($abc1 eq "") { next; } print " file $abc1 \n"; $dd=`date`; print "$dd\n"; `perl -i -pe 's/[^[:ascii:]]//g; tr/\015//d' $abc1`; print "junk character removed\n"; `sed -i 's/QOS_PROFILE_ID/x1/g;s/CHARGING_PROFILE_ID/x2/g;s/CONTENT_FI +LTERING_PROFILE_ID/x3/g;s/SUBSCRIBERID/x4/g;s/RECORD_LENGTH/x5/g;s/RE +CORD_TYPE/x6/g;s/EVENT_ID/x7/g;s/EVENT_RESULT/x8/g;s/CAUSE_PROTOCOL/x +9/g;s/DEFAULT_BEARER_ID/x0/g;s/ARP_PRIORITY_LEVEL/y1/g;s/ARP_CAPABILI +TY/y2/g;s/ARP_VULNERABILITY/y3/g;s/BEARER_CONTROL_MODE/y4/g;s/TRACKIN +G_AREA_CODE/y5/g;s/ROUTING_AREA_CODE/y7/g;s/SERVICE_AREA_CODE/y8/g;s/ +SYSTEM_IDENTIFIER/y9/g;s/NETWORK_IDENTIFIER/y0/g' $abc1`; `sed -i 's/GX_RAR_RAA_TRANSACTION/TRAR/g;s/GX_CCR_CCA_TRANSACTION/TCCA +/g;s/QUOTA_GRANTED/TQG/g;s/QOS_ASSIGNED_TO_DEFAULT_BEARER/TQA/g;s/RUL +E_INSTALLED/TRI/g;s/RULE_REMOVED/TRR/g' $abc1`; move($abc1,"/data/admin/scripts/SapcmedadpebM/xdecoder/decodedir/compl +eat/"); #`mv -i $abc1 /data/admin/scripts/SapcmedadpebM/xdecoder/decodedir/com +pleat/`; } unlink "text.out"; } else { print "Exiting \n"; exit; } sleep(100); }
Now the problem is that above two sed commands are taking more time than required...so could you please help me find the better and faster replacement of tese commands? please let me know if you need further info. thanks...
In reply to Faster replacement of sed commands.. by Ankur_kuls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |