Misplaced Pages

:Sandbox/Archive: Difference between revisions - Misplaced Pages

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Misplaced Pages:Sandbox Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 06:56, 30 March 2006 view source82.226.209.234 (talk)No edit summary← Previous edit Revision as of 07:02, 30 March 2006 view source 67.175.221.73 (talk)No edit summaryNext edit →
Line 2: Line 2:
<!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. --> <!-- Hello! Feel free to try your formatting and editing skills below this line. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->


--] 07:02, 30 March 2006 (UTC)



<font size="3" color="black" face="verdana"> ''' SED ''' </font><br /> <font size="3" color="black" face="verdana"> ''' SED ''' </font><br />

Revision as of 07:02, 30 March 2006

Welcome to this sandbox page, a space to experiment with editing.

You can either edit the source code ("Edit source" tab above) or use VisualEditor ("Edit" tab above). Click the "Publish changes" button when finished. You can click "Show preview" to see a preview of your edits, or "Show changes" to see what you have changed.

Anyone can edit this page and it is automatically cleared regularly (anything you write will not remain indefinitely). Click here to reset the sandbox.

You can access your personal sandbox by clicking here, or using the "Sandbox" link in the top right.Creating an account gives you access to a personal sandbox, among other benefits.

Do NOT, under any circumstances, place promotional, copyrighted, offensive, or libelous content in sandbox pages. Repeatedly doing so WILL get you blocked from editing.

For more info about sandboxes, see Misplaced Pages:About the sandbox and Help:My sandbox. New to Misplaced Pages? See the contributing to Misplaced Pages page or our tutorial. Questions? Try the Teahouse!


Sandbox navigation
Information
Misplaced Pages sandboxes
Template sandboxes
Draft sandboxes
User sandboxes
Module sandboxes
File sandboxes
My sandboxes
Test wikis

--67.175.221.73 07:02, 30 March 2006 (UTC)

SED

___________________________________________
CARACTERISTIQUES

Sed semble être un éditeur de texte un peu particulier ... qui n'agit pas sur un fichier texte mais sur le résultat d'une commande de shell par exemple.



___________________________________
SITES WEB

www.haypocalc.com/Sed
Une petite presentation simple de la commande.
___________________________________________
EXEMPLE 1

http://linuxfr.org/forums/26/13108.html

Je voudrais insérer une nouvelle ligne après un mot précis :

Ex: monfichier :
AA
BB
CC

doit se transformer en :
AA
BB
#truc bidules machin
CC

L'insertion d'une nouvelle ligne ne pose pas de problème, par contre, je ne comprends pas pourquoi il ne veut pas insérer d'espace la ligne à insérer.

J'ai utilisé :
sed -e s#BB#BB\\ntrucbidules#g mon fichier

Et voilà ce que j'aimerais passer :
sed -e s#BB#BB\\n truc bidules machin#g Current

Est-ce que je dois utiliser un caractère spécial dans le sed ?

REPONSES :

En mettant quelques "simples quotes", cela marche mieux :
sed 's#BB#&\ntruc bidules machin#g' mon fichier

et avec un -ei ?
sed -ei 's#BB#&\ntruc bidules machin#g' mon fichier

___________________________________________
EXEMPLE 2

J'ai besoin de sélectionner certaines lignes d'un fichier texte.
Ces lignes sont délimitées par des balises (similaires à des balises html).

ex:
AA
BB
CC
DD
EE
'Directory'
FF
GG
HH
'Directory'

...et je voulais supprimer les lignes qui apparaissent entre les balises 'Directory' :
* sed -e "/'Directory'/,/'\Directory'/d" test.txt

Voir l'exemple complet sur http://linuxfr.org/forums/26/13068.html

___________________________________________

Category:
Misplaced Pages:Sandbox/Archive: Difference between revisions Add topic