|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi
I want to get rid of possible ampersands in files in a certain directory with sed. As i know so far i have to use the original file then write to a second file. As i want the original name i have to rename the generated files afterwards. That is what i am basically trying to do. Probabely i commit a mistake by naming files or variables. I am back to trial an error and as not succesfull requesting for . Part of the script... .... pfad2="/home/peter/rss-urteile/bge-2000/entscheide/" kurt="/home/peter/rss-urteile/bge-2000/entscheide/susi" .... cd $pfad2; for gulu in $pfad2"*[[:digit:]]"; do cp $gulu $kurt; sed 's/\&/∓/g' $kurt > $gulu; rm /home/peter/rss-urteile/bge-2000/entscheide/susi; done .... The following errors are produced: cp: `/home/peter/rss-urteile/bge-2000/entscheide/susi': specified destination directory does not exist Try `cp --' for more information. ../zza.sh: line 61: $gulu: ambiguous redirect rm: cannot remove `/home/peter/rss-urteile/bge-2000/entscheide/susi': No such file or directory Any is appreciated. Thanks. Peter Guyan, Chur |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
> for gulu in $pfad2"*[[:digit:]]"; do cp $gulu $kurt; sed 's/\&/∓/g'
> $kurt > $gulu; rm /home/peter/rss-urteile/bge-2000/entscheide/susi; done Always take your in this case my time. It's not elegant, but it works. for gulu in *[[:digit:]]; do cp $gulu $gulu"_temp"; sed 's/\&/∓/g' $gulu"_temp" > $gulu ; rm $gulu"_temp"; done yours Peter |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Sat, 26 Aug 2006 16:47:06 +0200, Peter Guyan
<peter.guyan@tele_zwei_.ch> wrote: > > > Part of the script... > ... > pfad2="/home/peter/rss-urteile/bge-2000/entscheide/" > kurt="/home/peter/rss-urteile/bge-2000/entscheide/susi" > ... > cd $pfad2; > for gulu in $pfad2"*[[:digit:]]"; > do > cp $gulu $kurt; > sed 's/\&/∓/g' $kurt > > $gulu; > rm /home/peter/rss-urteile/bge-2000/entscheide/susi; > done > ... > > The following errors are produced: > cp: `/home/peter/rss-urteile/bge-2000/entscheide/susi': specified destination > directory does not exist Because you quoted the wildcard, it was expanded in the wrong place. cp sees more than two arguments, so it expects the last argument to be a directory. > Try `cp --' for more information. > ./zza.sh: line 61: $gulu: ambiguous redirect > rm: cannot remove `/home/peter/rss-urteile/bge-2000/entscheide/susi': No such > file or directory > > Any is appreciated. > Thanks. > for gulu in $pfad2*[[:digit:]] -- Still looking for the glorious results of my misspent youth. Say, do you have a map to the next joint? |
|
![]() |
| Outils de la discussion | |
|
|