Not completely but a bit off topic question: looking for texteditor with macro capabillity

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
Hi all,

There is so much knowledge around here that I give it a try, i hope the
moderater will let me.

I have been using for about 25 years PE.exe. This is a programmers
texteditor from word perfect.

for example you could do in dos ¨dir > dir.lst

open the document pe dir.lst
it shows for example

a list of
d:\foto\digikam\photo.jpg
then very easy make a macro to put in front ¨move ¨ ¨
then search for ¨\¨ then block and search twice again for ¨\¨
than copy the ¨\foto\digikam\¨ part
put at the end of the row ¨¨ O:\and paste
and add copiedphoto.jpg
now you have something like
move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
and you can apply it to all rows.

make it a batch file and execute.
wow!

And as you all know by now, I am after saying goodby to windows, this is
the next problem to tackle.

Yes, it is a horrible example, but how do linux people do things like that?

You can do things to an amazing  extend of complexity. I used this very
much to get things done that no program in the world ever could.



Thanks in advance for tips.

Rinus

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

jdd@dodin.org
Le 27/08/2011 11:54, sleepless a écrit :

> And as you all know by now, I am after saying goodby to windows, this
> is the next problem to tackle.

most linux editors allow this, beginning with vi or emacs, may be
beaver can also do... and many others

jdd

--
http://www.dodin.net
http://www.youtube.com/user/jdddodinorg
http://jdd.blip.tv/
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Benjamin Girault
In reply to this post by Rinus
Hi Sleepless,

That is my first answer to this list, but I've been playing with the
linux command line for quite some years now.

2011/8/27 sleepless <[hidden email]>:
> for example you could do in dos ¨dir > dir.lst

To use such a list, you can use "$(ls)", or "$(ls <directory>)"...

> a list of
> d:\foto\digikam\photo.jpg
> then very easy make a macro to put in front ¨move ¨ ¨

... for example:

$ for f in $(ls); do move ${f} <target directory>; done

> then search for ¨\¨ then block and search twice again for ¨\¨

Let's say you want to copy from /mnt/data1/ to /mnt/data2/

${s} is your string (e.g. $(pwd), i.e. the directory you are in):

$ echo ${s} | sed -e "s#/mnt/data1\(/.*\)#\1#"

This line removes "/mnt/data1" from the string ${s}.

> than copy the ¨\foto\digikam\¨ part
> put at the end of the row ¨¨ O:\and paste
> and add copiedphoto.jpg
> now you have something like
> move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
> and you can apply it to all rows.

For this, you can do (from /mnt/data1/foto/digikam/ to
/mnt/data2/foto/digikam/):

$ for f in $(ls); do move ${f} $(pwd | sed -e "s#/mnt/data1\(/.*\)#\1/#"); done


For most batch jobs (dealing with files), you can use bash script,
either in one line like I wrote, or execute a file like this one
(which is easier to read):

$ cat batch.sh
#!/bin/bash
for f in $(ls)
do
    TARGET=$(pwd | sed -e "s#/mnt/data1\(/.*\)#\1/#")
    if [ ! -d ${TARGET} ]
    then
        mkdir -p ${TARGET}
    fi
    move ${f} ${TARGET}
done

Then (after a "chmod 755 batch.sh" to make it executable), you just
have to do this in the directory where your photos are:

$ ./batch.sh

Note that I added a test to create the directory in the target if it
is missing, and the one line command suppose that
/mnt/data2/foto/digikam already exists.

A better version would replace $(ls) with $(ls *.jpg) in case there
could be directories listed with $(ls).


sed is the key here (along with bash scripting). It stands for Simple
EDitor (simple does not mean easy here...), but it has no graphical
interface, it is always run the same way I did. You'll find it very
convenient if you learn how to use it. Note that some people will use
awk (I think) to do the same job.

I hope that helps.

--
Benjamin Girault.
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Photonoxx
In reply to this post by Rinus
My Answer is may be a little off topic too, but you probably could use  
spreadsheet to do that...

I explain (this works with libreoffice calc and gedit as texteditor) :

- You have your list in a text editor with one row per file.
- Select all, copy and paste this in a spreadsheet. You should have a  
dialog appearing to customize import of text info in a spreadsheet (for  
example create column when there's a "\"). With no option modifying, your  
list create one column with your list inside and one row per file.
- Copy paste this column, and search and replace what you want in this  
second one (for example, replace "d:\" by "o:\")
- insert a new column at start, and fill it with your prefix (here "move").
- Select cells of your three column, copy and paste theirs to your text  
editor.
- optionally, replace tabulation by space.

You have your modified list which can be used as a batch file.

Le Sat, 27 Aug 2011 11:54:21 +0200, sleepless <[hidden email]>  
a écrit:

> Hi all,
>
> There is so much knowledge around here that I give it a try, i hope the  
> moderater will let me.
>
> I have been using for about 25 years PE.exe. This is a programmers  
> texteditor from word perfect.
>
> for example you could do in dos ¨dir > dir.lst
>
> open the document pe dir.lst
> it shows for example
>
> a list of
> d:\foto\digikam\photo.jpg
> then very easy make a macro to put in front ¨move ¨ ¨
> then search for ¨\¨ then block and search twice again for ¨\¨
> than copy the ¨\foto\digikam\¨ part
> put at the end of the row ¨¨ O:\and paste
> and add copiedphoto.jpg
> now you have something like
> move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
> and you can apply it to all rows.
>
> make it a batch file and execute.
> wow!
>
> And as you all know by now, I am after saying goodby to windows, this is  
> the next problem to tackle.
>
> Yes, it is a horrible example, but how do linux people do things like  
> that?
>
> You can do things to an amazing  extend of complexity. I used this very  
> much to get things done that no program in the world ever could.
>
>
>
> Thanks in advance for tips.
>
> Rinus
>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users


--
--
Nicolas Boulesteix
Photographe chasseur de lueurs
http://www.photonoxx.fr
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
In reply to this post by Rinus
Thanks a lot for all responses, that helps a lot to get me going.
Emacs looks great, I just have to learn all new keystrokes, and the
batch script language, I will have to learn again also.
And for the tip on the spreadsheet, I can´t believe that I never have
thought about that, very usefull.
Thank again,

Rinus
Op 27-08-11 11:54, sleepless schreef:

> Hi all,
>
> There is so much knowledge around here that I give it a try, i hope
> the moderater will let me.
>
> I have been using for about 25 years PE.exe. This is a programmers
> texteditor from word perfect.
>
> for example you could do in dos ¨dir > dir.lst
>
> open the document pe dir.lst
> it shows for example
>
> a list of
> d:\foto\digikam\photo.jpg
> then very easy make a macro to put in front ¨move ¨ ¨
> then search for ¨\¨ then block and search twice again for ¨\¨
> than copy the ¨\foto\digikam\¨ part
> put at the end of the row ¨¨ O:\and paste
> and add copiedphoto.jpg
> now you have something like
> move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
> and you can apply it to all rows.
>
> make it a batch file and execute.
> wow!
>
> And as you all know by now, I am after saying goodby to windows, this
> is the next problem to tackle.
>
> Yes, it is a horrible example, but how do linux people do things like
> that?
>
> You can do things to an amazing  extend of complexity. I used this
> very much to get things done that no program in the world ever could.
>
>
>
> Thanks in advance for tips.
>
> Rinus
>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Johnny
sleepless <[hidden email]> writes:

> Thanks a lot for all responses, that helps a lot to get me going.
> Emacs looks great, I just have to learn all new keystrokes, and the
> batch script language, I will have to learn again also.
> And for the tip on the spreadsheet, I can´t believe that I never have
> thought about that, very usefull.

I missed the start of the thread, here's my 2p. Or make it 3, as firstly
the spreadsheet is tentatively doable, but I would not encourage it for
this type of task, unless you are already a savvy spreadsheet user and
not interested / have no time to learn the right tools for the job.

Benjamin gave a good introduction to bash scripting, something which
you'll inevitably learn while tinkering in Linux. The method of looping
over file names and doing somthing is versatile and many times useful as
you can do whatever necessary in the situation, I always keep a template
around to build upon. Sed and Awk are your friends for string parsing!

Learning emacs is a great investment, but it requires time and
patience. Do /not/ configure it to be "Windows like" by changing
key-bindings - learning the defaults pay off in the long run. There's a
built in tutorial (press control and h followed by t, 'C-h t' in lingua
emacs). After this you'll be on your way to emacs mastery, but remember
to be patient. For moving files around, you'd like to look at
'dired'. Use 'C-h i' to bring up an info buffer and then press 'h' again
for a tutorial on info, and then use your newly acquired skills to
navigate to the 'dired' node to learn more about dired. For the 'macro
capability' you may want to look at the keybindings 'C-x (', 'C-x )' and
'C-x e'.

However, the most efficient way to do what you want to move certain
files around is arguably to use 'find' in a bash terminal. Just open up
a terminal, then to copy all files with a .jpg suffix from
/dir/to/search/ to /dir/to/copy/to/ do:

,----
| find /dir/to/search/ -maxdepth 1 -type f -iregex .*\.jpg$ -exec cp {} /dir/to/copy/to/ \;
`----

If you want to move the files, change 'cp' to 'mv'.

If you have photos in subfolders as well that you want to move, just
increase maxdepth to the desired subfolder level to search.

Regards,
--
Johnny
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
Op 27-08-11 22:25, Johnny schreef:

> sleepless<[hidden email]>  writes:
>
>> Thanks a lot for all responses, that helps a lot to get me going.
>> Emacs looks great, I just have to learn all new keystrokes, and the
>> batch script language, I will have to learn again also.
>> And for the tip on the spreadsheet, I can´t believe that I never have
>> thought about that, very usefull.
> I missed the start of the thread, here's my 2p. Or make it 3, as firstly
> the spreadsheet is tentatively doable, but I would not encourage it for
> this type of task, unless you are already a savvy spreadsheet user and
> not interested / have no time to learn the right tools for the job.
>
> Benjamin gave a good introduction to bash scripting, something which
> you'll inevitably learn while tinkering in Linux. The method of looping
> over file names and doing somthing is versatile and many times useful as
> you can do whatever necessary in the situation, I always keep a template
> around to build upon. Sed and Awk are your friends for string parsing!
>
> Learning emacs is a great investment, but it requires time and
> patience. Do /not/ configure it to be "Windows like" by changing
> key-bindings - learning the defaults pay off in the long run. There's a
> built in tutorial (press control and h followed by t, 'C-h t' in lingua
> emacs). After this you'll be on your way to emacs mastery, but remember
> to be patient. For moving files around, you'd like to look at
> 'dired'. Use 'C-h i' to bring up an info buffer and then press 'h' again
> for a tutorial on info, and then use your newly acquired skills to
> navigate to the 'dired' node to learn more about dired. For the 'macro
> capability' you may want to look at the keybindings 'C-x (', 'C-x )' and
> 'C-x e'.
>
> However, the most efficient way to do what you want to move certain
> files around is arguably to use 'find' in a bash terminal. Just open up
> a terminal, then to copy all files with a .jpg suffix from
> /dir/to/search/ to /dir/to/copy/to/ do:
>
> ,----
> | find /dir/to/search/ -maxdepth 1 -type f -iregex .*\.jpg$ -exec cp {} /dir/to/copy/to/ \;
compare this to
copy dir\to\search\*.jpg /s dir\to\copy

but realy good brain teasers of this kind are very appealing to me and I
can see how powerfull it is, I will crack this nut!
Your reply set me even more on the track end provoked a even stronger
interest in going this way.
Thanks!
Rinus


> If you want to move the files, change 'cp' to 'mv'.
>
> If you have photos in subfolders as well that you want to move, just
> increase maxdepth to the desired subfolder level to search.
>
> Regards,

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Johnny
sleepless <[hidden email]> writes:

>> ,----
>> | find /dir/to/search/ -maxdepth 1 -type f -iregex .*\.jpg$ -exec cp {} /dir/to/copy/to/ \;
> compare this to
> copy dir\to\search\*.jpg /s dir\to\copy

Well, this would be the same as:

,----
| cp /dir/to/search/*.jpg /dir/to/copy/to/
`----

This limits you however to only searching one directory at a time,
whereas find lets you search your entire HDD if you want for jpgs (or
whatever files you specify), but is good enough if that's all you need.

Compare this to what you initially described and Benjamin showed how to
do in a shell script; you could also use 'find' to loop over files
and operate on them by changing the part after '-exec' to do what you
want, e.g. 'mv' for move 'rm' for delete and so on.

--
Johnny
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
In reply to this post by Rinus
Hi linux people,

I have been wrestling a bit and ran quite quick in some sort of obstacle.

this works fine
mv *.* ../TEMP2/


but this one
  for f in $(ls); do mv ${f} ../TEMP2/; done

does not work if you have file names with spaces.

does that mean that for comfortable working in linux I have to rename my
1 billion files to file_names_like_this.ext?

Regards,
Rinus





Op 27-08-11 11:54, sleepless schreef:

> Hi all,
>
> There is so much knowledge around here that I give it a try, i hope
> the moderater will let me.
>
> I have been using for about 25 years PE.exe. This is a programmers
> texteditor from word perfect.
>
> for example you could do in dos ¨dir > dir.lst
>
> open the document pe dir.lst
> it shows for example
>
> a list of
> d:\foto\digikam\photo.jpg
> then very easy make a macro to put in front ¨move ¨ ¨
> then search for ¨\¨ then block and search twice again for ¨\¨
> than copy the ¨\foto\digikam\¨ part
> put at the end of the row ¨¨ O:\and paste
> and add copiedphoto.jpg
> now you have something like
> move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
> and you can apply it to all rows.
>
> make it a batch file and execute.
> wow!
>
> And as you all know by now, I am after saying goodby to windows, this
> is the next problem to tackle.
>
> Yes, it is a horrible example, but how do linux people do things like
> that?
>
> You can do things to an amazing  extend of complexity. I used this
> very much to get things done that no program in the world ever could.
>
>
>
> Thanks in advance for tips.
>
> Rinus
>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Johnny
sleepless <[hidden email]> writes:

> Hi linux people,
>
> I have been wrestling a bit and ran quite quick in some sort of obstacle.
>
> this works fine
> mv *.* ../TEMP2/
>
>
> but this one
>  for f in $(ls); do mv ${f} ../TEMP2/; done
>
> does not work if you have file names with spaces.
>
> does that mean that for comfortable working in linux I have to rename
> my 1 billion files to file_names_like_this.ext?
>

No, you can just use something like
,----
| for f in "$(ls)"; do mv "${f} ../TEMP2/"; done
`----
to handle spaces.

--
Johnny
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Benjamin Girault
In reply to this post by Rinus
Hi Rinus,

2011/8/28 sleepless <[hidden email]>:
> I have been wrestling a bit and ran quite quick in some sort of obstacle.
>
> this works fine
> mv *.* ../TEMP2/
>
>
> but this one
>  for f in $(ls); do mv ${f} ../TEMP2/; done

Try this:

for f in $(ls); do mv $(echo $f | sed -e "s# #\\\\ #g") ../TEMP2/; done

It replaces every space with "\ " which should do the trick
(hopefully, I haven't tested).

Best,

--
Benjamin Girault.
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
Thanks for the quick responses.
Unfortunately both solutions do not work.
Best,
Rinus
Op 28-08-11 17:48, Benjamin GIRAULT schreef:

> Hi Rinus,
>
> 2011/8/28 sleepless<[hidden email]>:
>> I have been wrestling a bit and ran quite quick in some sort of obstacle.
>>
>> this works fine
>> mv *.* ../TEMP2/
>>
>>
>> but this one
>>   for f in $(ls); do mv ${f} ../TEMP2/; done
> Try this:
>
> for f in $(ls); do mv $(echo $f | sed -e "s# #\\\\ #g") ../TEMP2/; done
>
> It replaces every space with "\ " which should do the trick
> (hopefully, I haven't tested).
>
> Best,
>

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Benjamin Girault
In reply to this post by Johnny
2011/8/28 Johnny <[hidden email]>:

> sleepless <[hidden email]> writes:
>
>> Hi linux people,
>>
>> I have been wrestling a bit and ran quite quick in some sort of obstacle.
>>
>> this works fine
>> mv *.* ../TEMP2/
>>
>>
>> but this one
>>  for f in $(ls); do mv ${f} ../TEMP2/; done
>>
>> does not work if you have file names with spaces.
>>
>> does that mean that for comfortable working in linux I have to rename
>> my 1 billion files to file_names_like_this.ext?
>>
>
> No, you can just use something like
> ,----
> | for f in "$(ls)"; do mv "${f} ../TEMP2/"; done
> `----
> to handle spaces.

That may not work because the second " character does not seem to be
at the right place. Try this:

,----
| for f in "$(ls)"; do mv "${f}" ../TEMP2/; done
`----

--
Benjamin Girault.
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
Op 28-08-11 19:27, Benjamin GIRAULT schreef:

> 2011/8/28 Johnny<[hidden email]>:
>> sleepless<[hidden email]>  writes:
>>
>>> Hi linux people,
>>>
>>> I have been wrestling a bit and ran quite quick in some sort of obstacle.
>>>
>>> this works fine
>>> mv *.* ../TEMP2/
>>>
>>>
>>> but this one
>>>   for f in $(ls); do mv ${f} ../TEMP2/; done
>>>
>>> does not work if you have file names with spaces.
>>>
>>> does that mean that for comfortable working in linux I have to rename
>>> my 1 billion files to file_names_like_this.ext?
>>>
>> No, you can just use something like
>> ,----
>> | for f in "$(ls)"; do mv "${f} ../TEMP2/"; done
>> `----
>> to handle spaces.
> That may not work because the second " character does not seem to be
> at the right place. Try this:
>
> ,----
> | for f in "$(ls)"; do mv "${f}" ../TEMP2/; done
> `----
>
I tried the quotes at lots of different places, but no luck.
I just found a page somewhere stating that it will never work with for.
For will always break the line despite of the quotes.
It seems to be possible with while, but thats another story.

Thanks a lot sofar,
Best,
Rinus
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Benjamin Girault
2011/8/28 sleepless <[hidden email]>:
> I tried the quotes at lots of different places, but no luck.
> I just found a page somewhere stating that it will never work with for. For
> will always break the line despite of the quotes.
> It seems to be possible with while, but thats another story.

You are right, I see why it couldn't work now.

Have you tried with find like Johnny suggested? This may do the trick:

,----
| find . -maxdepth 1 -type f -iregex .*\.jpg$ -exec mv {} ../TEMP2/ \;
`----

--
Benjamin Girault.
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
Op 28-08-11 22:10, Benjamin GIRAULT schreef:

> 2011/8/28 sleepless<[hidden email]>:
>> I tried the quotes at lots of different places, but no luck.
>> I just found a page somewhere stating that it will never work with for. For
>> will always break the line despite of the quotes.
>> It seems to be possible with while, but thats another story.
> You are right, I see why it couldn't work now.
>
> Have you tried with find like Johnny suggested? This may do the trick:
>
> ,----
> | find . -maxdepth 1 -type f -iregex .*\.jpg$ -exec mv {} ../TEMP2/ \;
> `----
>
Thanks, I will have a look at it later.

Rinus
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Dan McDaniel
In reply to this post by Rinus
On Sun 28.Aug.11 19:55, sleepless wrote:

>Op 28-08-11 19:27, Benjamin GIRAULT schreef:
>>2011/8/28 Johnny<[hidden email]>:
>>>sleepless<[hidden email]>  writes:
>>>
>>>>Hi linux people,
>>>>
>>>>I have been wrestling a bit and ran quite quick in some sort of obstacle.
>>>>
>>>>this works fine
>>>>mv *.* ../TEMP2/
>>>>
>>>>
>>>>but this one
>>>>  for f in $(ls); do mv ${f} ../TEMP2/; done
>>>>
>>>>does not work if you have file names with spaces.
>>>>
>>>>does that mean that for comfortable working in linux I have to rename
>>>>my 1 billion files to file_names_like_this.ext?
>>>>
>>>No, you can just use something like
>>>,----
>>>| for f in "$(ls)"; do mv "${f} ../TEMP2/"; done
>>>`----
>>>to handle spaces.
>>That may not work because the second " character does not seem to be
>>at the right place. Try this:
>>
>>,----
>>| for f in "$(ls)"; do mv "${f}" ../TEMP2/; done
>>`----
>>
>I tried the quotes at lots of different places, but no luck.
>I just found a page somewhere stating that it will never work with
>for. For will always break the line despite of the quotes.
>It seems to be possible with while, but thats another story.

This seems to work:

   for f in *; mv "$f" ../TEMP2; done

If the target folder also has spaces then quote it as well:

   for f in *; mv "$f" "../TEMP 2"; done

Dan


_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Rinus
In reply to this post by Rinus
Hi,
One more question. I can imagine that someone got annoyed by this
discussion in the wrong place, so I decided not to go on with it. But
maybe someone has a great tip where to discuss bash scripting and maybe
after that emacs. After all I need to stay productive in Linux and
eventually I want to do whatever comes in my mind, as I could in good
old dos, with just a snap of my fingers

I have been looking around but could not all by myself really find what
fits my needs. For example: fora where questions have 678 views and zero
answers, or fora only suited for people who have been digging in to
Linux for years.

Thanks you all for all the help, you got me realy on the track, but
there is still a long way to go.

Best,
Rinus



Op 27-08-11 11:54, sleepless schreef:

> Hi all,
>
> There is so much knowledge around here that I give it a try, i hope
> the moderater will let me.
>
> I have been using for about 25 years PE.exe. This is a programmers
> texteditor from word perfect.
>
> for example you could do in dos ¨dir > dir.lst
>
> open the document pe dir.lst
> it shows for example
>
> a list of
> d:\foto\digikam\photo.jpg
> then very easy make a macro to put in front ¨move ¨ ¨
> then search for ¨\¨ then block and search twice again for ¨\¨
> than copy the ¨\foto\digikam\¨ part
> put at the end of the row ¨¨ O:\and paste
> and add copiedphoto.jpg
> now you have something like
> move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
> and you can apply it to all rows.
>
> make it a batch file and execute.
> wow!
>
> And as you all know by now, I am after saying goodby to windows, this
> is the next problem to tackle.
>
> Yes, it is a horrible example, but how do linux people do things like
> that?
>
> You can do things to an amazing  extend of complexity. I used this
> very much to get things done that no program in the world ever could.
>
>
>
> Thanks in advance for tips.
>
> Rinus
>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
>

_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Johnny
sleepless <[hidden email]> writes:

> I have been looking around but could not all by myself really find
> what fits my needs. For example: fora where questions have 678 views
> and zero answers, or fora only suited for people who have been digging
> in to Linux for years.

You can try some of the emacs mailing lists, or in general browse emacs
wiki to get started (but don't forget to follow the built-in tutorial
first 'C-h t' and try learn using the built-in info-system asap 'C-h i
h' before looking too much further, where 'C-h' is press control and h)
http://www.emacswiki.org/emacs/EmacsMailingLists

For bash, you could start with Machtelt Garrels excellent introduction:
http://tldp.org/LDP/Bash-Beginners-Guide/html/
(pdf: http://tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf)

--
Johnny
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
Reply | Threaded
Open this post in threaded view
|

Re: Not completely but a bit off topic question: looking for texteditor with macro capabillity

Richard Mortimer-2
In reply to this post by Rinus


On 29/08/2011 20:35, sleepless wrote:

> Hi,
> One more question. I can imagine that someone got annoyed by this
> discussion in the wrong place, so I decided not to go on with it. But
> maybe someone has a great tip where to discuss bash scripting and maybe
> after that emacs. After all I need to stay productive in Linux and
> eventually I want to do whatever comes in my mind, as I could in good
> old dos, with just a snap of my fingers
>
> I have been looking around but could not all by myself really find what
> fits my needs. For example: fora where questions have 678 views and zero
> answers, or fora only suited for people who have been digging in to
> Linux for years.

Hi,

A good place to ask questions like you have been asking is
StackExchange. Specifically the Unix/Linux site or if you have an ubuntu
specific question ask on the ubuntu site.
http://unix.stackexchange.com/
http://askubuntu.com/

Each of the existing answers are tagged with various keywords so you can
look up potential answers before you ask specific questions. For
instance you can get all answers tagged with "bash" at
http://unix.stackexchange.com/questions/tagged/bash

Hope this is useful.

Regards

Richard


>
> Thanks you all for all the help, you got me realy on the track, but
> there is still a long way to go.
>
> Best,
> Rinus
>
>
>
> Op 27-08-11 11:54, sleepless schreef:
>> Hi all,
>>
>> There is so much knowledge around here that I give it a try, i hope
>> the moderater will let me.
>>
>> I have been using for about 25 years PE.exe. This is a programmers
>> texteditor from word perfect.
>>
>> for example you could do in dos ¨dir > dir.lst
>>
>> open the document pe dir.lst
>> it shows for example
>>
>> a list of
>> d:\foto\digikam\photo.jpg
>> then very easy make a macro to put in front ¨move ¨ ¨
>> then search for ¨\¨ then block and search twice again for ¨\¨
>> than copy the ¨\foto\digikam\¨ part
>> put at the end of the row ¨¨ O:\and paste
>> and add copiedphoto.jpg
>> now you have something like
>> move ¨d:\foto\digikam\photo.jpg¨ ¨O:\foto\digikam\photo.jpg¨
>> and you can apply it to all rows.
>>
>> make it a batch file and execute.
>> wow!
>>
>> And as you all know by now, I am after saying goodby to windows, this
>> is the next problem to tackle.
>>
>> Yes, it is a horrible example, but how do linux people do things like
>> that?
>>
>> You can do things to an amazing extend of complexity. I used this very
>> much to get things done that no program in the world ever could.
>>
>>
>>
>> Thanks in advance for tips.
>>
>> Rinus
>>
>> _______________________________________________
>> Digikam-users mailing list
>> [hidden email]
>> https://mail.kde.org/mailman/listinfo/digikam-users
>>
>
> _______________________________________________
> Digikam-users mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-users
_______________________________________________
Digikam-users mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-users
12