[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scripts for batch treatment

> I intend to copy a number of files chosen from a given directory. At  
> first, I've made a mistake : instead of deleting unwanted files from a  
> copy of said directory, I worked on deleting lines on a filelist that I  
> had extracted
> using 'ls -l > filename.txt'.

I am not sure I understand what you trying to do. Neither do I
understand what you did instead. :) If you just edited filename.txt in a
wrong way, whats preventing you from regenerating it?

> This sorting job,

Which sorting job? You didn't mention any sorting until now.

> on about 12,500 lines,  
> took several hours of my time,

Whoah! You didn't sort 12,500 lines manually, did you? You could have
just used 'sort'. If your hardware isn't ancient, that shouldn't take
more than a few seconds.

> and I hope to find a way to make use of  
> the result obtained, rather than re-doing the whole sorting job. The  
> sorted files number about 400 or so. Had it been only 2 or 3 dozens of  
> files, I would not have hesitated repeating the following command for  
> each file :
> cp  
> /mnt/exthd/home/bd/office52/user/desktop/etc/etc/filename_pasted_from_the_list 
> /home/mydir

for f in $files; do
 cp "/source/$f" /target/

> strings of characters since they are "subjects" of e-mails received via  
> StarOffice 5.1 and 5.2.

Ouch. You might have problems with my solution if the subjects contain
weird characters. Spaces shoudl be fine, though.

> P.S. I know nothing about shell scripts, so I might need a good tutorial  
> on this.

Advanced Bash-Scripting Guide.

If I had to live on a desert island I would take a mobile phone,
preferably a Nokia 8810.
[Agree]   [Disagree]

Attachment: signature.asc
Description: Digital signature

Reply to: