Re: [Perl-unix-users] Regex Problem

2002-03-06 Thread Jason Purdy
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

[Perl-unix-users] Regex Problem

2002-03-06 Thread Geoff Ellis
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

Re: [Perl-unix-users] Regex problem

2002-01-07 Thread $Bill Luebkert
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

Re: [Perl-unix-users] Regex problem

2002-01-07 Thread Jim Angstadt
--- 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

Re: [Perl-unix-users] Regex problem

2002-01-07 Thread Jason Purdy
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

[Perl-unix-users] Regex problem

2002-01-07 Thread Craig Sharp
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