Re: how to rename a file with "!", "?", and other strange chars?
in message <[EMAIL PROTECTED]>, wrote Gary Kline thusly... > > On Sun, Sep 18, 2005 at 04:57:35AM -0400, Parv wrote: [perlmonks.org references] > I've just signed aboard as a novice perlmonk... You shall eventually be rewarded for your hard work and dedication. Welcome to the cult. - Parv -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: how to rename a file with "!", "?", and other strange chars?
On Sun, Sep 18, 2005 at 04:57:35AM -0400, Parv wrote: > in message <[EMAIL PROTECTED]>, > wrote Gary Kline thusly... > > > > I scarfed up a slew of php files that are around 100 bytes in > > strlen and with "\ " and other non-shell-friendly bytes. Is there > > a way to use perl to chop off the first N bytes? > > > > For example, a file many be named 1\ 2xyz\?3=Test.php. > > What's the most logical way to perl this file to "Test.php? > > Perl: > http://perlmonks.org/index.pl?node_id=303814 > http://perlmonks.org/index.pl?node_id=277174 > I've just signed aboard as a novice perlmonk... gary -- Gary Kline [EMAIL PROTECTED] www.thought.org Public service Unix ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: how to rename a file with "!", "?", and other strange chars?
in message <[EMAIL PROTECTED]>, wrote Gary Kline thusly... > > I scarfed up a slew of php files that are around 100 bytes in > strlen and with "\ " and other non-shell-friendly bytes. Is there > a way to use perl to chop off the first N bytes? > > For example, a file many be named 1\ 2xyz\?3=Test.php. > What's the most logical way to perl this file to "Test.php? Perl: http://perlmonks.org/index.pl?node_id=303814 http://perlmonks.org/index.pl?node_id=277174 Other: http://groups.google.com/groups?q=%22file+name%22+unusal+OR+weird+characters+group%3Acomp.unix.* http://groups.google.com/groups?q=rename+unusal+OR+weird+characters+group%3Acomp.unix.* - Parv -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: how to rename a file with "!", "?", and other strange chars?
On 9/17/05, Gary Kline <[EMAIL PROTECTED]> wrote: > > I scarfed up a slew of php files that are around 100 bytes > in strlen and with "\ " and other non-shell-friendly bytes. > Is there a way to use perl to chop off the first N bytes? > > For example, a file many be named 1\ > 2xyz\?3=Test.php. What's the most logical way to > perl this file to "Test.php? a script you run as: % script.pl * from the directory these files are in might look like: foreach $old (@ARGV) { $new = $old; $new =~ s/\W//g; rename $old, $new; } That would remove all non "word" characters in the filename. Perl defines word characters as A-Z 0-9 and underscores. or you could do something like this: foreach $old (@ARGV) { $old =~ /(\w+\.php)/; rename $old, $1; } which catches any series of one or more word characters, a period, and "php" in the variable $1. There are lots of options, sounds like you need a book on perl maybe... There is good online documentation here: http://perldoc.perl.org/perl.html Aaron ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
how to rename a file with "!", "?", and other strange chars?
I scarfed up a slew of php files that are around 100 bytes in strlen and with "\ " and other non-shell-friendly bytes. Is there a way to use perl to chop off the first N bytes? For example, a file many be named 1\ 2xyz\?3=Test.php. What's the most logical way to perl this file to "Test.php? gary -- Gary Kline [EMAIL PROTECTED] www.thought.org Public service Unix ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"