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
Could someone let me know how I take out any non printable characters from a
string, i.e. anything except a-z, 0-9, space, and I think anything upto a
tilda , if it's possible in 1 regex it would be great..
thanks
Geoff
___
Perl-Unix-Users mailing li
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
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
Note the inclusion of the dashes.
Here is another