blob: c6cd9f8c1d624343af5842d8ea0643d0a82999d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-discuss] Debian-style «rename» utility?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-discuss%40mageia.org?Subject=Re%3A%20%5BMageia-discuss%5D%0A%20%3D%3Fiso-8859-15%3Fq%3FDebian-style_%3DABrename%3DBB_utilit%3F%3D%0A%20%3D%3Fiso-8859-15%3Fq%3Fy%3D3F%3F%3D&In-Reply-To=%3C201301020724.22251.renaud%40olgiati-in-paraguay.org%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="009036.html">
<LINK REL="Next" HREF="009038.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-discuss] Debian-style «rename» utility?</H1>
<B>Renaud (Ron) Olgiati</B>
<A HREF="mailto:mageia-discuss%40mageia.org?Subject=Re%3A%20%5BMageia-discuss%5D%0A%20%3D%3Fiso-8859-15%3Fq%3FDebian-style_%3DABrename%3DBB_utilit%3F%3D%0A%20%3D%3Fiso-8859-15%3Fq%3Fy%3D3F%3F%3D&In-Reply-To=%3C201301020724.22251.renaud%40olgiati-in-paraguay.org%3E"
TITLE="[Mageia-discuss] Debian-style «rename» utility?">renaud at olgiati-in-paraguay.org
</A><BR>
<I>Wed Jan 2 11:24:22 CET 2013</I>
<P><UL>
<LI>Previous message: <A HREF="009036.html">[Mageia-discuss] Debian-style «rename» utility?
</A></li>
<LI>Next message: <A HREF="009038.html">[Mageia-discuss] Software RAID
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9037">[ date ]</a>
<a href="thread.html#9037">[ thread ]</a>
<a href="subject.html#9037">[ subject ]</a>
<a href="author.html#9037">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On Tuesday 01 Jan 2013 21:13 my mailbox was graced by a message from Renaud
(Ron) Olgiati who wrote:
><i> I have been removing spaces and a number of characters that cause problems
</I>><i> in filenames with the following:
</I>><i>
</I>><i> #!/bin/bash
</I>><i> ls | grep " " >totototo
</I>><i> while [ -s totototo ]
</I>><i> do
</I>><i> rename " " _ *" "*
</I>><i> ls | grep " " >totototo
</I>><i> done
</I>><i> for CHR in "(" ")" "," "%" "'" ":" ";" "__" "_-"
</I>><i> do
</I>><i> ls | grep $CHR >totototo
</I>><i> while [ -s totototo ]
</I>><i> do
</I>><i> rename $CHR "" *$CHR*
</I>><i> ls | grep $CHR >totototo
</I>><i> done
</I>><i> rm -f totototo
</I>><i> done
</I>><i> echo "Finished !"
</I>><i>
</I>><i> Forgot why the space character is treated apart from the others, but ISTR
</I>><i> that the for would not work if $CHR was a space.
</I>
It came back ! It is because the spaces are replaced by an _ while the
characters, or groups of characters, in the "for CHR in..." line are simply
removed.
Cheers,
Ron.
--
Les vieux donnent de bons conseils pour se consoler
de ne plus pouvoir donner le mauvais exemple.
-- La Rochefoucauld
-- <A HREF="http://www.olgiati-in-paraguay.org">http://www.olgiati-in-paraguay.org</A> --
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="009036.html">[Mageia-discuss] Debian-style «rename» utility?
</A></li>
<LI>Next message: <A HREF="009038.html">[Mageia-discuss] Software RAID
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9037">[ date ]</a>
<a href="thread.html#9037">[ thread ]</a>
<a href="subject.html#9037">[ subject ]</a>
<a href="author.html#9037">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-discuss">More information about the Mageia-discuss
mailing list</a><br>
</body></html>
|