Skip to main content
deleted 4 characters in body
Source Link
chaos
  • 4.2k
  • 2
  • 20
  • 28

You could generate the mv command using this:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue_\1\"dialogue\1\/"/g'; done

Now, the command are printed like this:

mv "DLG023-00-01.prosody.json" "dialogue_023"dialogue023/"
[...]
mv "DLG028-00-01.prosody.json" "dialogue_028"dialogue028/"
[...]

If it is what you want, just pipe that output to bash and it will be executed:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue_\1\"dialogue\1\/"/g'; done | bash

You could generate the mv command using this:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue_\1\/"/g'; done

Now, the command are printed like this:

mv "DLG023-00-01.prosody.json" "dialogue_023/"
[...]
mv "DLG028-00-01.prosody.json" "dialogue_028/"
[...]

If it is what you want, just pipe that output to bash and it will be executed:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue_\1\/"/g'; done | bash

You could generate the mv command using this:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue\1\/"/g'; done

Now, the command are printed like this:

mv "DLG023-00-01.prosody.json" "dialogue023/"
[...]
mv "DLG028-00-01.prosody.json" "dialogue028/"
[...]

If it is what you want, just pipe that output to bash and it will be executed:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue\1\/"/g'; done | bash
Source Link
chaos
  • 4.2k
  • 2
  • 20
  • 28

You could generate the mv command using this:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue_\1\/"/g'; done

Now, the command are printed like this:

mv "DLG023-00-01.prosody.json" "dialogue_023/"
[...]
mv "DLG028-00-01.prosody.json" "dialogue_028/"
[...]

If it is what you want, just pipe that output to bash and it will be executed:

for f in DLG*; do echo "$f" | sed 's/DLG\([0-9]\+\).*/mv "\0" "dialogue_\1\/"/g'; done | bash