Need to replace 32 length string to *****

Hello,

I've a file file_1.txt

ul.ln = 'Kb' AND (il.sum = 'ec7ccc92585adac28d9b1fb5eff0473f' or length('ec7ccc92585adac28d9b1fb5eff0473f') = 7);
il.sum = '20ddc1368d588dd0b0e37c41721e05b1' OR length('20ddc1368d588dd0b0e37c41721e05b1') = 7);

I need to replace the file like below -

ul.ln = 'Kb' AND (il.sum = '*****' or length('*****') = 7);
il.sum = '*****' OR length('*****') = 7);

I tried it using sed but no luck. Please assist the ways.

Regards,
Mannu

Please show us the sed code you tried. And, be much more descriptive about what constitutes a 32 character string. (Do things like \n count as one character or two? Are there any other "special" cases? Are strings all surrounded by single-quotes? Etc.)

\n count as a single character. there are no more special cases and yes strings all surrounded by single-quotes.

I've used the below code but not approaching to the result - bit of success

sed "s/\(il.sum =\)\(.\{34\}\)/\ il.sum = '********************************/"

Hi,

can you try the below one ?

sed -e 's/\([a-f0-9]\{10,\}\)/*****/g' file

gives desired output:

Note: I used 10 in regular expression to differentiate plain words . Modify if your input contents are not fit with this .

or if your input is fixed with 32 characters as showed in input sample:

sed -e 's/\([a-f0-9]\{32\}\)/*****/g file

If there are no other single-quotes which do not surrount strings (like in "don't know") you can do this:

sed 's/\'[^\']\{32,\}\'/\'*****\'/g'

Replace 32 (or more) non-single-quote-characters surrounded by single-quotes.

I hope this helps.

bakunin