Well, I'm not sure what you mean by "anything upto a tilda", but you can
write 1 regex to do what you want:
$ more test.pl
#!/usr/bin/perl
$line = '(^FLJK asdf435jk~@!#$';
print "LINE (before): $line\n";
$line =~ s/[^\w\s~]//g;
print "LINE (after): $line\n";
$ perl test.pl
LINE (before): (^FL
Craig Sharp wrote:
> Hi all,
>
>
>
> I have a file with lines that are in the following format:
>
>
>
> 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
>
>
>
> I need to do a substitution so that the line appears as:
>
>
>
> 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
>
>
>
> Not
--- Craig Sharp <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a file with lines that are in the following
> format:
>
> 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3
>
> I need to do a substitution so that the line appears
> as:
>
> 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3
Another
Well, looking at the pattern, it looks like you need to start your
substitution when the pattern matches 'bNN' and ends when it hits an IP
address, matching 'NN\.' or 'NNN\.'.
So, here's some (baby-talk ;)) code:
#!/usr/bin/perl
$line = "20011219 074645 b03 3524 switch 10.3.xxx.xxx 3";
# brea