URGENT:- Data Scrubbing
the above code is not working .....
please help me in writing this code in KSH,CSH,SH....
-----Post Update-----
hello guys,
I have wrote a awk prog ...as below to do it. but its doing for all the numbers inside the flatfile.
code#:
#!/usr/bin/awk -f
BEGIN {
CnvFrom = "0123456789";
CnvTo = "4590382617";
Field = 1;
}
{
newField = ""
for (i=1; i<=length($Field); i++) {
char = substr($Field, i, 1);
if (pos=index(CnvFrom, char))
char = substr(CnvTo, pos, 1)
newField = newField char
}
$Field = newField
print
}
But my requirment is to change/translate the values from the position(input parameter - $2) and length (input parameter - $3) for the flatfile mentioned in a directory (input parameter - $1). please help me ....
eg : scrub.ksh file1 68 9 ( $1 - filename, $2 -postion (68), $3 - lenth from position (9) )
Before scrub- file1:
---------------------
"37713000000","12000000202","0000000000000000000007102","0000377310013683931",20090114,20080301,20080331,20060304,+000000000005897."
"37713000000","12000000202","0000000000000000000007102","0000377310013683931",20090114,20080301,20080331,20060304,+000000000005897."
"37713000000","12000000202","0000000000000000000010739","0000377310044493243",20090114,20080501,20080531,20070224,+000000000000000."
"37713000000","12000000202","0000000000000000000010739","0000377311018365607",20090114,20080401,20080430,20070224"
After scrub -file1:
-----------------
"37713000000","12000000202","0000000000000000000007102","0000377310450210705",20090114,20080301,20080331,20060304,+000000000005897."
"37713000000","12000000202","0000000000000000000007102","0000377310450210705",20090114,20080301,20080331,20060304,+000000000005897."
"37713000000","12000000202","0000000000000000000010739","0000377310433370930",20090114,20080501,20080531,20070224,+000000000000000."
"37713000000","12000000202","0000000000000000000010739","0000377311451028246",20090114,20080401,20080430,20070224"
please help me ..... i want the scrub as per the input parameters.....
please help ....
Last edited by padhu.47; 05-27-2009 at 05:43 AM..