Hi All,
I would like to replace the hexadecimal value that is in the angular brackets with the decimal value of the same and print the lines with decimal value in it.
JDW-HP 1MVWV93V7j2Hxsa0Ag6 24:00:00 SUBJECT_EXACT _Did you<A0>serve our<A0>country? -New VA Home.Loan Program_
JDW-HP 1MVWV98Ddd4fLsa0Ag6 24:00:00 SUBJECT_EXACT Did.you.serve_our country? New-VA Home<A0>Loan Program_
This is the code i have written, how do i replace the hexadecimal value with the decimal value and print the whole line with new value?
#!/usr/bin/perl my %RULES; open (RUL,"<","/home/stummala/a"); while (<RUL>) { my $line = $_; chomp $line; if ( /<(.*)>/ ) { my $num = $1; $dec_num = sprintf("%d", hex($num)); print "$dec_num\n"; } } close RUL;
Thanks in advance for your help.
In reply to How do i replace one variable with another after searching for a pattern by Niklaus Mikaelson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |