![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help for a perl script - writing to a data file | meghana | Shell Programming and Scripting | 2 | 02-04-2008 05:05 PM |
| Writing CGI scripting using perl | alma | Shell Programming and Scripting | 7 | 04-23-2007 09:46 PM |
| Writing and executing a script in RTR implementation of UNIX | mahajan.anubhav | Shell Programming and Scripting | 0 | 03-16-2006 05:20 AM |
| Need help in writing a unix script | pray44u | Shell Programming and Scripting | 1 | 03-30-2005 07:15 AM |
| Writing perl module | jo_aze | Shell Programming and Scripting | 4 | 08-06-2003 11:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi Folks,
I posted a few days ago, thanks for the responses. My original question was for renaming files of sort 3p2325294.dgn in a directory containing multiple files. I need to drop the first 2 characters and the last in a unix script using Perl. How does it differ from using the Unix Shells? Syntax examples please. Much appreciated. Dinkster |
|
||||
|
Well, if You use the shell You are working in, from the command line or in a script, You are using less resources than You would do if You invoke an external program. You are using functions that are "already there". It's not very important in day to day work if a job takes 10 seconds instead of 2. The trade-off comes into play when You are dealing with very large amounts of data. Perl can be very efficient but if You are only traversing Your home directory for renaming dgn-files, it is probably much easier to just use what You already have. Portability and complexity are other considerations.
Your example could be expressed in a shell (this works for bash on the command line) as: Code:
for x in *.dng;do mv $x ${x:2};done
I think that once You get used to the shell You realise the power of it. There are so many examples of piping stuff through sed and awk and perl, when the answer is already at Your fingertips. I've done it myself a lot. It may be easier because You know how sed works so You go for it instead of exploring the shell equivalent. And I'm not entirely sure about how it would be written in Perl, I'm a bit rusty in that department... /Lakris |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|