[ale] editing variables in bash (or shell)

Asif E. asifem at gmail.com
Thu Mar 10 16:31:01 EST 2005


Maybe

dest_file_name=`echo $src_file_name | sed 's%/%-%g'`




On Thu, 10 Mar 2005 16:01:45 -0500, Greg Freemyer
<greg.freemyer at gmail.com> wrote:
> I'm writing a script to crawl my data disk and collect a bunch of
> similar files in one place.
> 
> I can use find to make the list of files.
> 
> Then I can use a construct like:
> 
> cat /tmp/files | while read orig_file_name
> do
> echo $orig_file_name
> done
> 
> to print out the list of files I need to collect.
> 
> Now I want to collect them in one place without losing the detail of
> where they came from.
> 
> I'm thinking something like this would work:
> 
> cp /data/path/file ./data-path-file
> 
> To do that, I need to create a variable dest_file_name that takes the
> '/' and replaces them with '-' chars.  I know you can do that in the
> shell, but I've forgotten how.
> 
> Any assistance?
> 
> Thanks
> Greg
> --
> Greg Freemyer
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>



More information about the Ale mailing list