One liner

2008-02-13 Thread Dermot
Hi, ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh I concocted the above command to change files named A1234. to A1234.jpg Is there a pure perl one-liner for this? Just curious. Thanx, Dp.

Re: One liner

2008-02-13 Thread Robert Leibl
Dermot wrote: > Hi, > > ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh > > > I concocted the above command to change files named > > A1234. to A1234.jpg > > Is there a pure perl one-liner for this? Just curious. > > Thanx, > Dp. > perl -e 'rename $_, $_."jpg" foreach (glob

Re: One liner

2008-02-13 Thread John W. Krahn
Dermot wrote: Hi, Hello, ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh I concocted the above command to change files named A1234. to A1234.jpg Is there a pure perl one-liner for this? Just curious. perl -e'rename$_,"${_}jpg"or warn"$_: $!"for<*.>' John -- Perl isn'

Re: cgi upload -> XMLin

2008-02-13 Thread Brent Clark
Chas. Owens wrote: The XMLin method takes a string, file, or file handle as its argument. Just pass $upload_filehandle to it: my $ref = $xs->XMLin($cgi->upload("filename")); print $xs->XMLout($ref); Hi Thanks for replying. To be honest, I did try that, but then i was getting this message.

Re: Newbie File Question....

2008-02-13 Thread Rob Coops
On a unix/linux file system you see the following: $ ls -la total 244 drwx--9 rcoops ddao24096 Feb 13 09:40 . drwxr-xr-x 39 root root 4096 Feb 11 13:23 .. -rw---1 rcoops ddao2 158310 Feb 13 09:40 .bash_history -rw-r--r--1 rcoops ddao2 2

Re: Newbie File Question....

2008-02-13 Thread Kashif Salman
On Feb 13, 2008 8:34 AM, <[EMAIL PROTECTED]> wrote: > I've been going over some listings and I found code > > like the following: > > > > "./directory/file.txt" and > > "../directory/file.txt" > > > > but I've never seen the "./" and "../" things at the > > beginning of the path. I've tried to goo

Newbie File Question....

2008-02-13 Thread Richard.Copits
I've been going over some listings and I found code like the following: "./directory/file.txt" and "../directory/file.txt" but I've never seen the "./" and "../" things at the beginning of the path. I've tried to google these but had no luck. I've googled "file specification" and "dire

Re: Newbie File Question....

2008-02-13 Thread Michael Barnes
[EMAIL PROTECTED] told me on 02/13/2008 10:34 AM: > I've been going over some listings and I found code > > like the following: > > > > "./directory/file.txt" and > > "../directory/file.txt" > > > > but I've never seen the "./" and "../" things at the > > beginning of the path. I've trie

Re: Newbie File Question....

2008-02-13 Thread MK
On 02/13/2008 11:34:56 AM, [EMAIL PROTECTED] wrote: -> I've been going over some listings and I found code -> -> like the following: -> -> -> -> "./directory/file.txt" and -> -> "../directory/file.txt" this is not really a perl question, but since perl does respect the reference: "." and ".."

Re: cgi upload -> XMLin

2008-02-13 Thread Jay Savage
On Feb 13, 2008 12:52 AM, Brent Clark <[EMAIL PROTECTED]> wrote: > Chas. Owens wrote: > > > The XMLin method takes a string, file, or file handle as its argument. > > Just pass $upload_filehandle to it: > > > > my $ref = $xs->XMLin($cgi->upload("filename")); > > print $xs->XMLout($ref); > > Hi > >

Re: Newbie File Question....

2008-02-13 Thread David Moreno
On Feb 13, 2008 12:30 PM, <[EMAIL PROTECTED]> wrote: > Thank you to all who replied to this requestnow I > understand! I appreciate the help and the courtesy > of the replies! Once againThank You!! "One more satisfied customer" -said somewhere sometime by merlyn. -- David Moreno - http

RE: Newbie File Question....

2008-02-13 Thread Richard.Copits
Thank you to all who replied to this requestnow I understand! I appreciate the help and the courtesy of the replies! Once againThank You!! -Original Message- From: Copits Dick Sent: Wednesday, February 13, 2008 11:35 AM To: beginners@perl.org Subject: Newbie File Question I'v

Re: One liner

2008-02-13 Thread Randal L. Schwartz
> "Robert" == Robert Leibl <[EMAIL PROTECTED]> writes: Robert> Dermot wrote: >> Hi, >> >> ls | perl -ne 'print if /\.$/'| sed 's/\(.*\)/mv & \1jpg/' | sh >> >> >> I concocted the above command to change files named >> >> A1234. to A1234.jpg >> >> Is there a pure perl one-liner for this?

Re: order of command line switch?

2008-02-13 Thread Kashif Salman
On Feb 13, 2008 11:57 AM, ciwei <[EMAIL PROTECTED]> wrote: > hostA>ls > SUNWjassVRTSVRTSicsco VRTSvcs > emc SUNWmlibVRTSalloc VRTSjre VRTSvlicVRTSvxvm > > hostA>ls | perl -en 'print if /SUNW/' > > return nothing , while > > hostA>ls | perl -ne 'print if /SUNW/'

order of command line switch?

2008-02-13 Thread ciwei
hostA>ls SUNWjassVRTSVRTSicsco VRTSvcs emc SUNWmlibVRTSalloc VRTSjre VRTSvlicVRTSvxvm hostA>ls | perl -en 'print if /SUNW/' return nothing , while hostA>ls | perl -ne 'print if /SUNW/' SUNWits SUNWjass SUNWmlib SUNWrtvc so why the order of -n -e switch mak

Re: order of command line switch?

2008-02-13 Thread Chas. Owens
On Feb 13, 2008 2:57 PM, ciwei <[EMAIL PROTECTED]> wrote: snip > so why the order of -n -e switch make the differience? > this is perl 5.8.4. > Thanks snip This is true in all versions of Perl. It is becuase you are allowed to have more than one -e option: perl -e 'print "read ";' -e 'print "th