Timeline for bash extract first number from filename
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 10, 2015 at 8:25 | vote | accept | Fabien Snauwaert | ||
May 29, 2015 at 16:55 | comment | added | Fabien Snauwaert | It's always chars 3-6 (or 4-6 for now.) | |
May 29, 2015 at 16:55 | comment | added | Fabien Snauwaert | Thank you Michael, that's the clever way to go about it. | |
May 29, 2015 at 16:51 | answer | added | jherran | timeline score: 0 | |
May 29, 2015 at 14:20 | answer | added | fd0 | timeline score: 1 | |
S May 29, 2015 at 14:01 | history | suggested | chaos |
added relevant tags
|
|
May 29, 2015 at 13:51 | review | Suggested edits | |||
S May 29, 2015 at 14:01 | |||||
May 29, 2015 at 13:50 | answer | added | chaos | timeline score: 0 | |
May 29, 2015 at 13:25 | comment | added | Paul | Is it always chars 4-6? | |
May 29, 2015 at 12:28 | comment | added | user |
It doesn't actually extract the numbers, so it's not an answer to the question, but in principle you can also do something like for num in $(seq -f '%03g' 1 999); do test -d dialogue${num}||mkdir dialogue${num}; mv -t dialogue${num} DLG${num}-*; done followed by rmdir dialogue* -- the -f '%03g' means all numbers are zero-padded to at least three digits, and since 999 fits into three digits all numbers will become three digits long in the directory names. Plain rmdir fails if the directory is not empty, so is safe. Brace for unimportant error output from mv about nonexistent files.
|
|
May 29, 2015 at 12:18 | answer | added | fede.evol | timeline score: 0 | |
May 29, 2015 at 11:59 | history | asked | Fabien Snauwaert | CC BY-SA 3.0 |