vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| scooter6 wrote: > SCO OpenServer 5.0.5 all patches, etc.... > > > I have a process that I need to run more than once a day (as it was > originally designed) > > This process creates a directory with the julian date in it... > > i.e. /u/home/data/bcu253 > > once my program runs, there will be files there as such: > > 09090401.tar > 09090402.tar > 09090403.tar ... > So, at this point I have this directory: > > /u/home/data/bcu253 > > and I have the files in this directory called: > > 09090401.tar > 09090402.tar etc, etc etc. Well, I'm not going to write your script for you, but something like.: XX=`ls bcu253\*.tar|wc -l` XX=`echo $XX | sed s/ *//g` for i in *tar do XX=`expr $XX + 1` j=`echo $i | sed "s/^\(....\)../\1$XX/"` cp $i bcu253/$j done Easier in bash or ksh and a whole bunch easier in Perl. -- Tony Lawrence http://aplawrence.com |
| |||
| "Tony Lawrence" <pcunix@gmail.com> wrote in message news:<chqggt$s89@odbk17.prod.google.com>... > scooter6 wrote: > > SCO OpenServer 5.0.5 all patches, etc.... > > > > > > I have a process that I need to run more than once a day (as it was > > originally designed) > > > > This process creates a directory with the julian date in it... > > > > i.e. /u/home/data/bcu253 > > > > once my program runs, there will be files there as such: > > > > 09090401.tar > > 09090402.tar > > 09090403.tar > > .. > > > So, at this point I have this directory: > > > > /u/home/data/bcu253 > > > > and I have the files in this directory called: > > > > 09090401.tar > > 09090402.tar etc, etc > > etc. > > Well, I'm not going to write your script for you, but something like.: > > XX=`ls bcu253\*.tar|wc -l` > XX=`echo $XX | sed s/ *//g` > for i in *tar > do > > XX=`expr $XX + 1` > j=`echo $i | sed "s/^\(....\)../\1$XX/"` > cp $i bcu253/$j > > done > > Easier in bash or ksh and a whole bunch easier in Perl. Okay....I can do it in Perl...show me how please? ughhhh Scot |
| |||
| On 9 Sep 2004 21:19:27 -0700, sullmann@telespectrum.com (scooter6) wrote: [...] >> Well, I'm not going to write your script for you, but something like.: >> >> XX=`ls bcu253\*.tar|wc -l` >> XX=`echo $XX | sed s/ *//g` >> for i in *tar >> do >> >> XX=`expr $XX + 1` >> j=`echo $i | sed "s/^\(....\)../\1$XX/"` >> cp $i bcu253/$j >> >> done >> >> Easier in bash or ksh and a whole bunch easier in Perl. > >Okay....I can do it in Perl...show me how please? ughhhh This would suggest you can't actually do it in Perl... For god's sake man, put some bloody effort in and expand your skill set a little... |
| |||
| On 10 Sep 2004 08:54:35 -0700, "Tony Lawrence" <pcunix@gmail.com> wrote: [...] >> >> Easier in bash or ksh and a whole bunch easier in Perl. >> > >> >Okay....I can do it in Perl...show me how please? ughhhh >> >> This would suggest you can't actually do it in Perl... For god's sake >> man, put some bloody effort in and expand your skill set a little... > > > >Oh, don't be so mean. > >Yes, he really should expand his skills. He can start at >http://aplawrence.com/Unixart/loveperl.html > >But sometimes people just want to get things done NOW. I think the >suggestion to add hour and minute (even seconds if necessary) is >reasonable, but it may not be for him. Yeah, or easier still would be a set of directories, numbered 0-23, that the files could be moved into after the run (0-23 obviously being the run hour). That way, if he were looking for the tar created at 17:00 on 01/02/03, it's pretty simple to find. >He should be able to use the sh script suggestions I offered, but maybe >he doesn't understand that either - in that case, you are right, he's >way over his head and needs to pay somebody to do this for him. There's too much of this "spoon-feed me" mentality. Fair enough, I don't mind helping someone who's made an attempt to do somthing, then asks for help with a problem, but coming into a usenet group (or any other fora) and asking someone to write the script/code for them is just plain idle. Bit of a pet niggle of mine, since a new policy at my current workplace requires me to document all kinds of processes I go through to create a guide for others. Since the manager (and others) are point'n'click monkeys, the documentation goes along the lines of "use PuTTY, with username x, password y to log in. Type cd blah/blah, type ls -ltr, then...". This is due to the fact the manager doesn't want to actually learn anything new, just parrot what's written down. If I change anything, it's a whole new load of docs. I did question why the docs should be "idiot proof", since it's generally not a good idea to let an idiot run around as root on a commercial UNIX system (and yes, we have had incidents, like somebody changing to the root dir by mistake (again, parroting my notes - and mistyping), then typing chmod 700 *, which basically knocked 200 people off the system during a busy afternoon. Then the manager editing scripts (to change some comments to his liking for some reason) with MS Word, using Samba, which again went unnoticed until we realised that no orders had been allocated stock all afternoon. It also seems that if someone neglects to document any possible error or problem that could occur with any system (in idiot style), it's neglegent... </rant> |
| ||||
| In article <d6c4k0pt00j15thtq2r0l13ddmvkvdhoff@4ax.com>, FyRE <FyRE@toktik.d.co.uk.invalid> wrote: >On 10 Sep 2004 08:54:35 -0700, "Tony Lawrence" <pcunix@gmail.com> >wrote: > >[...] > >>> >> Easier in bash or ksh and a whole bunch easier in Perl. >>> >Okay....I can do it in Perl...show me how please? ughhhh >>> This would suggest you can't actually do it in Perl... For god's sake >>> man, put some bloody effort in and expand your skill set a little... >>Oh, don't be so mean. ..... >Bit of a pet niggle of mine, since a new policy at my current >workplace requires me to document all kinds of processes I go through >to create a guide for others. Since the manager (and others) are >point'n'click monkeys, the documentation goes along the lines of "use >PuTTY, with username x, password y to log in. Type cd blah/blah, type >ls -ltr, then...". This is due to the fact the manager doesn't want to >actually learn anything new, just parrot what's written down. If I >change anything, it's a whole new load of docs. I did question why the >docs should be "idiot proof", since it's generally not a good idea to >let an idiot run around as root on a commercial UNIX system (and yes, >we have had incidents, like somebody changing to the root dir by >mistake (again, parroting my notes - and mistyping), then typing chmod >700 *, which basically knocked 200 people off the system during a busy >afternoon. I have tried to minimize this by changing all the systems I maintain so the root home directory is /root and not / I don't know how many SCO / directories I had to clean trash out of when someone added SW that deposited detritus in that directory. It also minimizes the accidental cd before an rm -r * This is the default mode on FreeBSD and Linux, but I've had absolutely no problems moving root's home to /root on either SCO or Solaris. Just because things were designed poorly to start with is no reason we have to live with it. Bill -- Bill Vermillion - bv @ wjv . com |