Remplacement de mots automatisés en ligne de commande ou interface graphique [Réglé]

zalappy Membre non connecté
-
- Voir le profil du membre zalappy
- Inscrit le : 28/07/2012
- Groupes :
Reprise du message précédent
Bonjour, voici un exemple concret que j'ai utilisé la dernière fois.Tu as le choix entre:
%s/mot origine,/Mot remplacement,/
/mot origine,/Mot remplacement,/
mot origine,/Mot remplacement,/
mot origine,/Mot remplacement,
la liste est là:
Caché :
%s/3d,/Three Dimensional,/
%s/animation,/Animation - Moving Image,/
%s/audio,/Audio Equipment,/
%s/backdrop,/Backdrop - Artificial Scene,/
%s/background,/Backgrounds,/
%s/bass,/Double Bass,/
%s/bug,/Insect,/
%s/button,/Push Button,/
%s/cell,/Biological Cell,/
%s/classic,/Elegance,/
%s/clef,/Bass Clef,/
%s/clip,/Moving Image,/
%s/club,/Entertainment Club,/
%s/colony,/Colony - Group of Animals,/
%s/color,/Colors,/
%s/colorful,/Multi Colored,/
%s/concept,/Concepts,/
%s/creative,/Creativity,/
%s/culture,/Cultures,/
%s/decor,/Home Decor,/
%s/decoration,/Decoration,/
%s/digital,/Digital Display,/
%s/disco,/Disco Dancing,/
%s/drawing,/Drawing - Art Product,/
%s/elegant,/Elegance,/
%s/element,/The Four Elements,/
%s/geometric,/Geometric Shape,/
%s/golden,/Gold Colored,/
%s/graphic,/Computer Graphic,/
%s/grid,/Grid Pattern,/
%s/half,/Half Full,/
%s/hive,/Beehive,/
%s/honeycomb,/Honeycomb Pattern,/
%s/instrument,/Musical Instrument,/
%s/jazz,/Jazz Music,/
%s/light,/Lighting Equipment,/
%s/musical,/Music,/
%s/note,/Musical Note,/
%s/orange,/Orange Color,/
%s/panel,/Control Panel,/
%s/pictogram,/Symbol,/
%s/play,/Playing,/
%s/retro,/Retro Style,/
%s/sheet,/Sheet - Bedding,/
%s/sing,/Singing,/
%s/sound,/Sound Recording Equipment,/
%s/structure,/Built Structure,/
%s/style,/Fashion,/
%s/swarm,/Swarm of Insects,/
%s/texture,/Textured,/
%s/treble,/Treble Clef,/
%s/wall,/Wall - Building Feature,/
%s/wallpaper,/Wallpaper - Decor,/
%s/wildlife,/Animal Wildlife,/
/3d,/Three Dimensional,/
/animation,/Animation - Moving Image,/
/audio,/Audio Equipment,/
/backdrop,/Backdrop - Artificial Scene,/
/background,/Backgrounds,/
/bass,/Double Bass,/
/bug,/Insect,/
/button,/Push Button,/
/cell,/Biological Cell,/
/classic,/Elegance,/
/clef,/Bass Clef,/
/clip,/Moving Image,/
/club,/Entertainment Club,/
/colony,/Colony - Group of Animals,/
/color,/Colors,/
/colorful,/Multi Colored,/
/concept,/Concepts,/
/creative,/Creativity,/
/culture,/Cultures,/
/decor,/Home Decor,/
/decoration,/Decoration,/
/digital,/Digital Display,/
/disco,/Disco Dancing,/
/drawing,/Drawing - Art Product,/
/elegant,/Elegance,/
/element,/The Four Elements,/
/geometric,/Geometric Shape,/
/golden,/Gold Colored,/
/graphic,/Computer Graphic,/
/grid,/Grid Pattern,/
/half,/Half Full,/
/hive,/Beehive,/
/honeycomb,/Honeycomb Pattern,/
/instrument,/Musical Instrument,/
/jazz,/Jazz Music,/
/light,/Lighting Equipment,/
/musical,/Music,/
/note,/Musical Note,/
/orange,/Orange Color,/
/panel,/Control Panel,/
/pictogram,/Symbol,/
/play,/Playing,/
/retro,/Retro Style,/
/sheet,/Sheet - Bedding,/
/sing,/Singing,/
/sound,/Sound Recording Equipment,/
/structure,/Built Structure,/
/style,/Fashion,/
/swarm,/Swarm of Insects,/
/texture,/Textured,/
/treble,/Treble Clef,/
/wall,/Wall - Building Feature,/
/wallpaper,/Wallpaper - Decor,/
/wildlife,/Animal Wildlife,/
3d,/Three Dimensional,/
animation,/Animation - Moving Image,/
audio,/Audio Equipment,/
backdrop,/Backdrop - Artificial Scene,/
background,/Backgrounds,/
bass,/Double Bass,/
bug,/Insect,/
button,/Push Button,/
cell,/Biological Cell,/
classic,/Elegance,/
clef,/Bass Clef,/
clip,/Moving Image,/
club,/Entertainment Club,/
colony,/Colony - Group of Animals,/
color,/Colors,/
colorful,/Multi Colored,/
concept,/Concepts,/
creative,/Creativity,/
culture,/Cultures,/
decor,/Home Decor,/
decoration,/Decoration,/
digital,/Digital Display,/
disco,/Disco Dancing,/
drawing,/Drawing - Art Product,/
elegant,/Elegance,/
element,/The Four Elements,/
geometric,/Geometric Shape,/
golden,/Gold Colored,/
graphic,/Computer Graphic,/
grid,/Grid Pattern,/
half,/Half Full,/
hive,/Beehive,/
honeycomb,/Honeycomb Pattern,/
instrument,/Musical Instrument,/
jazz,/Jazz Music,/
light,/Lighting Equipment,/
musical,/Music,/
note,/Musical Note,/
orange,/Orange Color,/
panel,/Control Panel,/
pictogram,/Symbol,/
play,/Playing,/
retro,/Retro Style,/
sheet,/Sheet - Bedding,/
sing,/Singing,/
sound,/Sound Recording Equipment,/
structure,/Built Structure,/
style,/Fashion,/
swarm,/Swarm of Insects,/
texture,/Textured,/
treble,/Treble Clef,/
wall,/Wall - Building Feature,/
wallpaper,/Wallpaper - Decor,/
wildlife,/Animal Wildlife,/
3d,/Three Dimensional,
animation,/Animation - Moving Image,
audio,/Audio Equipment,
backdrop,/Backdrop - Artificial Scene,
background,/Backgrounds,
bass,/Double Bass,
bug,/Insect,
button,/Push Button,
cell,/Biological Cell,
classic,/Elegance,
clef,/Bass Clef,
clip,/Moving Image,
club,/Entertainment Club,
colony,/Colony - Group of Animals,
color,/Colors,
colorful,/Multi Colored,
concept,/Concepts,
creative,/Creativity,
culture,/Cultures,
decor,/Home Decor,
decoration,/Decoration,
digital,/Digital Display,
disco,/Disco Dancing,
drawing,/Drawing - Art Product,
elegant,/Elegance,
element,/The Four Elements,
geometric,/Geometric Shape,
golden,/Gold Colored,
graphic,/Computer Graphic,
grid,/Grid Pattern,
half,/Half Full,
hive,/Beehive,
honeycomb,/Honeycomb Pattern,
instrument,/Musical Instrument,
jazz,/Jazz Music,
light,/Lighting Equipment,
musical,/Music,
note,/Musical Note,
orange,/Orange Color,
panel,/Control Panel,
pictogram,/Symbol,
play,/Playing,
retro,/Retro Style,
sheet,/Sheet - Bedding,
sing,/Singing,
sound,/Sound Recording Equipment,
structure,/Built Structure,
style,/Fashion,
swarm,/Swarm of Insects,
texture,/Textured,
treble,/Treble Clef,
wall,/Wall - Building Feature,
wallpaper,/Wallpaper - Decor,
wildlife,/Animal Wildlife,
%s/animation,/Animation - Moving Image,/
%s/audio,/Audio Equipment,/
%s/backdrop,/Backdrop - Artificial Scene,/
%s/background,/Backgrounds,/
%s/bass,/Double Bass,/
%s/bug,/Insect,/
%s/button,/Push Button,/
%s/cell,/Biological Cell,/
%s/classic,/Elegance,/
%s/clef,/Bass Clef,/
%s/clip,/Moving Image,/
%s/club,/Entertainment Club,/
%s/colony,/Colony - Group of Animals,/
%s/color,/Colors,/
%s/colorful,/Multi Colored,/
%s/concept,/Concepts,/
%s/creative,/Creativity,/
%s/culture,/Cultures,/
%s/decor,/Home Decor,/
%s/decoration,/Decoration,/
%s/digital,/Digital Display,/
%s/disco,/Disco Dancing,/
%s/drawing,/Drawing - Art Product,/
%s/elegant,/Elegance,/
%s/element,/The Four Elements,/
%s/geometric,/Geometric Shape,/
%s/golden,/Gold Colored,/
%s/graphic,/Computer Graphic,/
%s/grid,/Grid Pattern,/
%s/half,/Half Full,/
%s/hive,/Beehive,/
%s/honeycomb,/Honeycomb Pattern,/
%s/instrument,/Musical Instrument,/
%s/jazz,/Jazz Music,/
%s/light,/Lighting Equipment,/
%s/musical,/Music,/
%s/note,/Musical Note,/
%s/orange,/Orange Color,/
%s/panel,/Control Panel,/
%s/pictogram,/Symbol,/
%s/play,/Playing,/
%s/retro,/Retro Style,/
%s/sheet,/Sheet - Bedding,/
%s/sing,/Singing,/
%s/sound,/Sound Recording Equipment,/
%s/structure,/Built Structure,/
%s/style,/Fashion,/
%s/swarm,/Swarm of Insects,/
%s/texture,/Textured,/
%s/treble,/Treble Clef,/
%s/wall,/Wall - Building Feature,/
%s/wallpaper,/Wallpaper - Decor,/
%s/wildlife,/Animal Wildlife,/
/3d,/Three Dimensional,/
/animation,/Animation - Moving Image,/
/audio,/Audio Equipment,/
/backdrop,/Backdrop - Artificial Scene,/
/background,/Backgrounds,/
/bass,/Double Bass,/
/bug,/Insect,/
/button,/Push Button,/
/cell,/Biological Cell,/
/classic,/Elegance,/
/clef,/Bass Clef,/
/clip,/Moving Image,/
/club,/Entertainment Club,/
/colony,/Colony - Group of Animals,/
/color,/Colors,/
/colorful,/Multi Colored,/
/concept,/Concepts,/
/creative,/Creativity,/
/culture,/Cultures,/
/decor,/Home Decor,/
/decoration,/Decoration,/
/digital,/Digital Display,/
/disco,/Disco Dancing,/
/drawing,/Drawing - Art Product,/
/elegant,/Elegance,/
/element,/The Four Elements,/
/geometric,/Geometric Shape,/
/golden,/Gold Colored,/
/graphic,/Computer Graphic,/
/grid,/Grid Pattern,/
/half,/Half Full,/
/hive,/Beehive,/
/honeycomb,/Honeycomb Pattern,/
/instrument,/Musical Instrument,/
/jazz,/Jazz Music,/
/light,/Lighting Equipment,/
/musical,/Music,/
/note,/Musical Note,/
/orange,/Orange Color,/
/panel,/Control Panel,/
/pictogram,/Symbol,/
/play,/Playing,/
/retro,/Retro Style,/
/sheet,/Sheet - Bedding,/
/sing,/Singing,/
/sound,/Sound Recording Equipment,/
/structure,/Built Structure,/
/style,/Fashion,/
/swarm,/Swarm of Insects,/
/texture,/Textured,/
/treble,/Treble Clef,/
/wall,/Wall - Building Feature,/
/wallpaper,/Wallpaper - Decor,/
/wildlife,/Animal Wildlife,/
3d,/Three Dimensional,/
animation,/Animation - Moving Image,/
audio,/Audio Equipment,/
backdrop,/Backdrop - Artificial Scene,/
background,/Backgrounds,/
bass,/Double Bass,/
bug,/Insect,/
button,/Push Button,/
cell,/Biological Cell,/
classic,/Elegance,/
clef,/Bass Clef,/
clip,/Moving Image,/
club,/Entertainment Club,/
colony,/Colony - Group of Animals,/
color,/Colors,/
colorful,/Multi Colored,/
concept,/Concepts,/
creative,/Creativity,/
culture,/Cultures,/
decor,/Home Decor,/
decoration,/Decoration,/
digital,/Digital Display,/
disco,/Disco Dancing,/
drawing,/Drawing - Art Product,/
elegant,/Elegance,/
element,/The Four Elements,/
geometric,/Geometric Shape,/
golden,/Gold Colored,/
graphic,/Computer Graphic,/
grid,/Grid Pattern,/
half,/Half Full,/
hive,/Beehive,/
honeycomb,/Honeycomb Pattern,/
instrument,/Musical Instrument,/
jazz,/Jazz Music,/
light,/Lighting Equipment,/
musical,/Music,/
note,/Musical Note,/
orange,/Orange Color,/
panel,/Control Panel,/
pictogram,/Symbol,/
play,/Playing,/
retro,/Retro Style,/
sheet,/Sheet - Bedding,/
sing,/Singing,/
sound,/Sound Recording Equipment,/
structure,/Built Structure,/
style,/Fashion,/
swarm,/Swarm of Insects,/
texture,/Textured,/
treble,/Treble Clef,/
wall,/Wall - Building Feature,/
wallpaper,/Wallpaper - Decor,/
wildlife,/Animal Wildlife,/
3d,/Three Dimensional,
animation,/Animation - Moving Image,
audio,/Audio Equipment,
backdrop,/Backdrop - Artificial Scene,
background,/Backgrounds,
bass,/Double Bass,
bug,/Insect,
button,/Push Button,
cell,/Biological Cell,
classic,/Elegance,
clef,/Bass Clef,
clip,/Moving Image,
club,/Entertainment Club,
colony,/Colony - Group of Animals,
color,/Colors,
colorful,/Multi Colored,
concept,/Concepts,
creative,/Creativity,
culture,/Cultures,
decor,/Home Decor,
decoration,/Decoration,
digital,/Digital Display,
disco,/Disco Dancing,
drawing,/Drawing - Art Product,
elegant,/Elegance,
element,/The Four Elements,
geometric,/Geometric Shape,
golden,/Gold Colored,
graphic,/Computer Graphic,
grid,/Grid Pattern,
half,/Half Full,
hive,/Beehive,
honeycomb,/Honeycomb Pattern,
instrument,/Musical Instrument,
jazz,/Jazz Music,
light,/Lighting Equipment,
musical,/Music,
note,/Musical Note,
orange,/Orange Color,
panel,/Control Panel,
pictogram,/Symbol,
play,/Playing,
retro,/Retro Style,
sheet,/Sheet - Bedding,
sing,/Singing,
sound,/Sound Recording Equipment,
structure,/Built Structure,
style,/Fashion,
swarm,/Swarm of Insects,
texture,/Textured,
treble,/Treble Clef,
wall,/Wall - Building Feature,
wallpaper,/Wallpaper - Decor,
wildlife,/Animal Wildlife,
Tu choisis celui que tu veux, donc là c'est le "fichier d'entré" pour le listing repère et connaitre les mots à rechercher et remplacer.
Et ici maintenant un fichier très raccourci "le fichier de sortie" c'est la liste de mots ou il faut appliquer les corrections.
Caché :
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, silhouette, digital, graphic, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, gold, golden, animation, cartoon,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, animation, cartoon, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, gold, golden, yellow,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, 3d, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, orange,
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, pictogram, shape, silhouette, digital, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, red, pink, background black,
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, silhouette, digital, graphic, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, gold, golden, animation, cartoon,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, animation, cartoon, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, gold, golden, yellow,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, 3d, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, orange,
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, pictogram, shape, silhouette, digital, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, red, pink, background black,
Merci

<table class="formatter-table">
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>

Jybz Membre non connecté
-
- Voir le profil du membre Jybz
- Inscrit le : 10/10/2018
- Groupes :
-
Administrateur
-
Forgeron
Je regarde ce soir ou demain.
Téléverser une image : /wiki/hebergement-de-fichiers-sur-mlo
Arch | Machine | OS |
x86_64 | lenovo x250 | mga9 |
armv7hl | bananapro | mga9 |
aarch64 | Raspberry Pi 4B | mga9 |

zalappy Membre non connecté
-
- Voir le profil du membre zalappy
- Inscrit le : 28/07/2012
- Groupes :
<table class="formatter-table">
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>

Jybz Membre non connecté
-
- Voir le profil du membre Jybz
- Inscrit le : 10/10/2018
- Groupes :
-
Administrateur
-
Forgeron
Alors j'ai modifié le script, c'est moins efficace... Mais ça va.
Code BASH :
#!/bin/bash -x REMPLACEMENT_LIST="${HOME}/tmp/inputR" FILE_TEXT="${HOME}/tmp/inputT" OLD_IFS=${IFS} IFS=$'\n' for LINE in $(cat ${REMPLACEMENT_LIST}) ; do sed -i -e "s/${LINE}/g" ${FILE_TEXT} done IFS=${OLD_IFS} exit 0
Téléverser une image : /wiki/hebergement-de-fichiers-sur-mlo
Arch | Machine | OS |
x86_64 | lenovo x250 | mga9 |
armv7hl | bananapro | mga9 |
aarch64 | Raspberry Pi 4B | mga9 |

zalappy Membre non connecté
-
- Voir le profil du membre zalappy
- Inscrit le : 28/07/2012
- Groupes :
inputR
le fichier de sortie:
inputT
et t'as placé les 2 dans:
/tmp
et t'as utilisé quel bloc pour l'entrée:
%s/mot origine,/Mot remplacement,/
/mot origine,/Mot remplacement,/
mot origine,/Mot remplacement,/
mot origine,/Mot remplacement,
corrige-moi?
merci
<table class="formatter-table">
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>

Jybz Membre non connecté
-
- Voir le profil du membre Jybz
- Inscrit le : 10/10/2018
- Groupes :
-
Administrateur
-
Forgeron
mot origine/mot remplacement
normalement ça fonctionne avec l'espace, les apostrophes. Attention : ça ne marchera pas avec / et " .
Téléverser une image : /wiki/hebergement-de-fichiers-sur-mlo
Arch | Machine | OS |
x86_64 | lenovo x250 | mga9 |
armv7hl | bananapro | mga9 |
aarch64 | Raspberry Pi 4B | mga9 |

zalappy Membre non connecté
-
- Voir le profil du membre zalappy
- Inscrit le : 28/07/2012
- Groupes :
j'ai lancé la commande:
./input-script
j'ai eu ce résultat:
Caché :
./input-script
+ REMPLACEMENT_LIST=/root/tmp/inputR
+ FILE_TEXT=/root/tmp/inputT
+ OLD_IFS='
'
+ IFS='
'
++ cat /root/tmp/inputR
cat: /root/tmp/inputR: Aucun fichier ou dossier de ce type
+ IFS='
'
+ exit 0
+ REMPLACEMENT_LIST=/root/tmp/inputR
+ FILE_TEXT=/root/tmp/inputT
+ OLD_IFS='
'
+ IFS='
'
++ cat /root/tmp/inputR
cat: /root/tmp/inputR: Aucun fichier ou dossier de ce type
+ IFS='
'
+ exit 0
et aucun résultat, comme je l'ai dit je me suis planté.
avec le .sh derrière ça ne fonctionne pas du tout
./input-script.sh
bash: ./input-script.sh: Aucun fichier ou dossier de ce type
je me suis logé avec la konsole dans le bon répertoire /tmp en y mettant les 3 fichiers.
j'ai nommé le script: input-script
<table class="formatter-table">
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>

zalappy Membre non connecté
-
- Voir le profil du membre zalappy
- Inscrit le : 28/07/2012
- Groupes :
<table class="formatter-table">
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>

Jybz Membre non connecté
-
- Voir le profil du membre Jybz
- Inscrit le : 10/10/2018
- Groupes :
-
Administrateur
-
Forgeron
Tu peux m'expliquer pourquoi tu t'es logué en root ?
Citation :
cat: /root/tmp/inputR: Aucun fichier ou dossier de ce type
Alors c'est très simple... Comment expliquer...
Un script, c'est un fichier texte regroupant des commandes, l'interpreteur est précisé à la première ligne /bin/bash, donc ce sont des commandes bash.
En gros, tu pourrais retaper ligne par ligne le script dans un terminal, ça fera la même chose, mais justement, il est fait pour ne pas le recopier, c'est le terminal qui s'en chargera, pour ça, il faut rendre ce fichier texte exécutable avec les options nécessaire, en console : chmod +x lenomduscript .
Souviens toi, sous linux, les extensions de fichier n'existent pas, le tout n'est qu'un nom. Donc si tu nommes ton script .sh, c'est pour donner une indication intelligible à l'utilisateur, toi et moi, ça ne change rien pour le PC, mais .sh fait "parti" du nom.
Pour lancer un script, soit il est sauvegarder dans un dossier répertorié dans la varaible PATH comme /bin par exemple, dans ce cas, il suffit de taper son nom, sinon, comme pour tout exécutable, il faut préciser son chemin avant le nom, que le chemin soit relatif ../autreSousDossier/fichierScript ou absolut /home/USER/autreSousDossier/fichierScript .
Le script utilise les variables $HOME qui est différent pour chaque utilisateur, allant de /home/$USER pour les utilisateurs classique à /root pour root.
Si tu mets le script dans le même dossier que tes fichiers à traiter, tu peux modifier les premières lignes :
Code BASH :
REMPLACEMENT_LIST="${HOME}/tmp/inputR" FILE_TEXT="${HOME}/tmp/inputT"
en
Code BASH :
REMPLACEMENT_LIST="./inputR" FILE_TEXT="./inputT"
(tu noteras l'utilisation d'un chemin relatif ( ./ ce même dossier) au lieu d'absolue à travers une variable ($HOME), pour complément inutile : . c'est le dossier courant, .. le dossier parent, tu as du déjà rencontrer cette commande : cd .. pour revenir au dossier parent je suppose, c'est exactement le chemin relatif.)
Résumé :
Ne pas se logger en root
mettre dans les fichiers dans /home/tonUtilisateur/tmp
admettons le script se nomme SCRIPT
on le met exécutable (disponible dans clic-droit propriété)
on le lance en console avec la commande :
/home/tonUtilisateur/tmp/SCRIPT
Téléverser une image : /wiki/hebergement-de-fichiers-sur-mlo
Arch | Machine | OS |
x86_64 | lenovo x250 | mga9 |
armv7hl | bananapro | mga9 |
aarch64 | Raspberry Pi 4B | mga9 |

zalappy Membre non connecté
-
- Voir le profil du membre zalappy
- Inscrit le : 28/07/2012
- Groupes :

Ça marche, ta contribution à m'avoir trouvé la solution va me faire gagner plus de temps encore

Sinon voici ce que j'ai fait exactement en ayant modifié par rapport à ton dernier message.
J'ai fait le test dans un dossier hors du /home
donc n'importe quel nom
exemple:
......./ztest-script
Dedans j'ai mis 3 fichiers:
inputR
inputT
le-script
le-script (je l'ai rendu éxécutable avec un clic droit) cocher éxécuter
le script (contient):
Caché :
#!/bin/bash -x
REMPLACEMENT_LIST="./inputR"
FILE_TEXT="./inputT"
OLD_IFS=${IFS}
IFS=$'\n'
for LINE in $(cat ${REMPLACEMENT_LIST}) ; do
sed -i -e "s/${LINE}/g" ${FILE_TEXT}
done
IFS=${OLD_IFS}
exit 0
#!/bin/bash -x
REMPLACEMENT_LIST="./inputR"
FILE_TEXT="./inputT"
OLD_IFS=${IFS}
IFS=$'\n'
for LINE in $(cat ${REMPLACEMENT_LIST}) ; do
sed -i -e "s/${LINE}/g" ${FILE_TEXT}
done
IFS=${OLD_IFS}
exit 0
inputR (contient) le bloc avec>
mot origine,/Mot remplacement,
Caché :
3d,/Three Dimensional,
animation,/Animation - Moving Image,
audio,/Audio Equipment,
backdrop,/Backdrop - Artificial Scene,
background,/Backgrounds,
bass,/Double Bass,
bug,/Insect,
button,/Push Button,
cell,/Biological Cell,
classic,/Elegance,
clef,/Bass Clef,
clip,/Moving Image,
club,/Entertainment Club,
colony,/Colony - Group of Animals,
color,/Colors,
colorful,/Multi Colored,
concept,/Concepts,
creative,/Creativity,
culture,/Cultures,
decor,/Home Decor,
decoration,/Decoration,
digital,/Digital Display,
disco,/Disco Dancing,
drawing,/Drawing - Art Product,
elegant,/Elegance,
element,/The Four Elements,
geometric,/Geometric Shape,
golden,/Gold Colored,
graphic,/Computer Graphic,
grid,/Grid Pattern,
half,/Half Full,
hive,/Beehive,
honeycomb,/Honeycomb Pattern,
instrument,/Musical Instrument,
jazz,/Jazz Music,
light,/Lighting Equipment,
musical,/Music,
note,/Musical Note,
orange,/Orange Color,
panel,/Control Panel,
pictogram,/Symbol,
play,/Playing,
retro,/Retro Style,
sheet,/Sheet - Bedding,
sing,/Singing,
sound,/Sound Recording Equipment,
structure,/Built Structure,
style,/Fashion,
swarm,/Swarm of Insects,
texture,/Textured,
treble,/Treble Clef,
wall,/Wall - Building Feature,
wallpaper,/Wallpaper - Decor,
wildlife,/Animal Wildlife,
3d,/Three Dimensional,
animation,/Animation - Moving Image,
audio,/Audio Equipment,
backdrop,/Backdrop - Artificial Scene,
background,/Backgrounds,
bass,/Double Bass,
bug,/Insect,
button,/Push Button,
cell,/Biological Cell,
classic,/Elegance,
clef,/Bass Clef,
clip,/Moving Image,
club,/Entertainment Club,
colony,/Colony - Group of Animals,
color,/Colors,
colorful,/Multi Colored,
concept,/Concepts,
creative,/Creativity,
culture,/Cultures,
decor,/Home Decor,
decoration,/Decoration,
digital,/Digital Display,
disco,/Disco Dancing,
drawing,/Drawing - Art Product,
elegant,/Elegance,
element,/The Four Elements,
geometric,/Geometric Shape,
golden,/Gold Colored,
graphic,/Computer Graphic,
grid,/Grid Pattern,
half,/Half Full,
hive,/Beehive,
honeycomb,/Honeycomb Pattern,
instrument,/Musical Instrument,
jazz,/Jazz Music,
light,/Lighting Equipment,
musical,/Music,
note,/Musical Note,
orange,/Orange Color,
panel,/Control Panel,
pictogram,/Symbol,
play,/Playing,
retro,/Retro Style,
sheet,/Sheet - Bedding,
sing,/Singing,
sound,/Sound Recording Equipment,
structure,/Built Structure,
style,/Fashion,
swarm,/Swarm of Insects,
texture,/Textured,
treble,/Treble Clef,
wall,/Wall - Building Feature,
wallpaper,/Wallpaper - Decor,
wildlife,/Animal Wildlife,
inputT contient au départ:
Caché :
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, silhouette, digital, graphic, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, gold, golden, animation, cartoon,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, animation, cartoon, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, gold, golden, yellow,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, 3d, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, orange,
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, pictogram, shape, silhouette, digital, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, red, pink, background black,
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, silhouette, digital, graphic, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, gold, golden, animation, cartoon,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, animation, cartoon, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, gold, golden, yellow,
beehive, hive, swarm, colony, bee, bug, insect, mosquito, wasp, honey, honeycomb, wax, food, alveolate, alveolus, cell, geometric, grid, hexagon, panel, texture, tile, wall, mosaic, illustration, wallpaper, animal, backdrop, light, shadow, shape, structure, modern, 3d, abstract, art, concept, creative, decor, decoration, design, pattern, style, wildlife, orange,
music, note, musical, icon, sound, symbol, melody, sign, audio, art, song, tune, instrument, key, clef, button, play, clip, club, concert, culture, disco, nightclub, retro, bass, jazz, synthesizer, half, melodic, sing, classic, elegant, element, modern, pictogram, shape, silhouette, digital, treble, illustration, design, decoration, decorative, abstract, background, style, drawing, red, pink, background black,
Je lance la konsole:
je reste en utilisateur sans être root, cd "nom du répertoire ou j'ai mon dossier"
ls (cela affiche bien mes 3 fichiers)
Bon je lance le script avec cette commande:
./le-script
Ensuite dans la konsole ça a fait défiler les remplacements, la commande avec le "sh" derrière soi:
./le-script.sh
n'a pas fonctionné c'est ce que j'ai fait en 1er.
<table class="formatter-table">
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>
<tr class="formatter-table-row">
<td class="formatter-table-col">Mageia7.1/6/5-64bits-Xfce</td>
<td class="formatter-table-col">Demander la maj d'un prog existant du CCM.</td>
<td class="formatter-table-col">[Tuto] Configuration d'un serveur LAMP</td>
</tr>
<tr class="formatter-table-row">
<td class="formatter-table-col">[Tuto] installer VeraCrypt.</td>
<td class="formatter-table-col">Cloner un disque, une partition</td>
<td class="formatter-table-col">Thèmes icônes xfce/plasma les modifiées</td>
</tr>
</table>

Jybz Membre non connecté
-
- Voir le profil du membre Jybz
- Inscrit le : 10/10/2018
- Groupes :
-
Administrateur
-
Forgeron
zalappy :
Ensuite dans la konsole ça a fait défiler les remplacements, la commande avec le "sh" derrière soi:
./le-script.sh
n'a pas fonctionné c'est ce que j'ai fait en 1er.
Ensuite dans la konsole ça a fait défiler les remplacements, la commande avec le "sh" derrière soi:
./le-script.sh
n'a pas fonctionné c'est ce que j'ai fait en 1er.
C'est normale, l'extension ça n'existe pas, le .quelquechose ça fait parti du nom.
Si tu renommes le fichier en lescript.sh alors la commande bash sera ./lescript.sh .
Téléverser une image : /wiki/hebergement-de-fichiers-sur-mlo
Arch | Machine | OS |
x86_64 | lenovo x250 | mga9 |
armv7hl | bananapro | mga9 |
aarch64 | Raspberry Pi 4B | mga9 |
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie