--Apple-Mail=_F0D367FC-F2F8-4D20-A40B-EF103619DCDD
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
Salut,
Histoire d’en rajouter une couche, la suggestion d’échapper les points était LA bonne solution car le point est interprété comme un caractère … quelconque ce qui peut être assez gênant non ?
J’aurais donc donné cette commande :
$ sed -i '/^49\.7\.20\./d' fichier.txt
sans le « -i » pour faire un test d’abord.
PS :
Il est préférable d’ajouter également le « . » à la fin pour éviter de supprimer par exemple une ligne « 49.7.201 » qu’on souhaiterai conserver par exemple…
A+
Le 12 sept. 2022 à 12:41, antoine.valmer <awache322@gmail.com> a écrit :
Le 9/09/22 à 19:22, antoine.valmer a écrit :
Bonjour à tous,
Dans un fichier texte, j'ai ce type de lignes :
49.7.20.111|17August2022
49.7.20.120|18August2022
Je souhaite supprimer toutes celles qui ont cette expression :
"49.7.20."
J'ai tenté cette commande :
sed '/49.7.20/d'
mais elle n'efface aucune ligne contenant "49.7.20."
Hello,
Grand merci à tous ceux qui m'ont répondu,
voici la commande que j'ai tapée :
sed -i '/49.7.20/d' fichier.txt
qui a bien marché.
Je retiens aussi les autres commandes qui m'ont été indiquées.
Bonne journée.
On Saturday 10 September 2022 11:06:15 Jean-Marc et d'autres wrote:
sed -i '/^49\.7\.20/d' nom-de-ton-fichier
--
Pierre Malard
Responsable architectures système CDS DINAMIS/THEIA Montpellier
IRD - UMR Espace-Dev - UAR CPST - IR Data-Terra
Maison de la Télédétection
500 rue Jean-François Breton
34093 Montpellier Cx 5
France
« Le socialisme vrai ne veut pas renverser l'ordre des classes ;
il veut fondre les classes dans une organisation du travail qui
sera meilleure pour tous »
Jean Jaures - "Les misères du patronat" - 1890
_,'| _.-''``-...___..--';)
/_ \'. __..-' , ,--...--'''
<\ .`--''' ` /'
`-';' ; ; ;
__...--'' ___...--_..' .;.'
(,__....----''' (,..--'' πr
perl -e '$_=q#: 3|\ 5_,3-3,2_: 3/,`.'"'"'`'"'"' 5-. ;-;;,_: |,A- ) )-,_. ,\ ( `'"'"'-'"'"': '"'"'-3'"'"'2(_/--'"'"' `-'"'"'\_): 24Ï€r::#;y#:#\n#;s#(\D)(\d+)#$1x$2#ge;print'
- --> Ce message n’engage que son auteur <--
--Apple-Mail=_F0D367FC-F2F8-4D20-A40B-EF103619DCDD
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=utf-8
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Salut,<div class=""><br class=""></div><div class="">Histoire d’
en rajouter une couche, la suggestion d’échapper les points était LA bonne solution car le point est interprété comme un caractère … quelconque ce qui peut être assez gênant non ?</div><div class=""><br class=""></div><div class="">J’aurais
donc donné cette commande :</div><div class=""><font face="Courier New" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>$ sed -i '/^49\.7\.20\./d' fichier.txt</font></div><div class="">sans le « -i » pour faire un
test d’abord.</div><div class=""><br class=""></div><div class="">PS :</div><div class="">Il est préférable d’ajouter également le « . » à la fin pour éviter de supprimer par exemple une ligne « 49.7.201 » qu’on
souhaiterai conserver par exemple…</div><div class=""><br class=""></div><div class="">A+</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">Le 12 sept. 2022 à 12:41, antoine.valmer <<a href="
mailto:
awache322@gmail.com" class="">
awache322@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">Le 9/09/22 à 19:22, antoine.valmer a écrit :<br class=""><
blockquote type="cite" class="">Bonjour à tous,<br class="">Dans un fichier texte, j'ai ce type de lignes :<br class="">49.7.20.111|17August2022<br class="">49.7.20.120|18August2022<br class="">Je souhaite supprimer toutes celles qui ont cette
expression :<br class="">"49.7.20."<br class="">J'ai tenté cette commande :<br class="">sed '/49.7.20/d'<br class="">mais elle n'efface aucune ligne contenant "49.7.20."<br class=""></blockquote></blockquote><br class="">Hello,<br class="">Grand merci Ã
tous ceux qui m'ont répondu,<br class="">voici la commande que j'ai tapée :<br class="">sed -i '/49.7.20/d' fichier.txt<br class="">qui a bien marché.<br class="">Je retiens aussi les autres commandes qui m'ont été indiquées.<br class="">Bonne
journée.<br class=""><br class=""><blockquote type="cite" class="">On Saturday 10 September 2022 11:06:15 Jean-Marc et d'autres wrote:<br class="">sed -i '/^49\.7\.20/d' nom-de-ton-fichier<br class=""></blockquote><br class=""></div></div></blockquote></
<br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-
wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space:
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-
spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"
class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-
break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-
nbsp-mode: space; line-break: after-white-space;" class=""><div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class="">-- </div><div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class=""><
div style="margin: 0px;" class="">Pierre Malard</div><div style="margin: 0px;" class="">Responsable architectures système CDS DINAMIS/THEIA Montpellier</div><span style="font-size: x-small;" class="">IRD - UMR Espace-Dev - UAR CPST - IR Data-Terra</span>
<br class=""><div style="margin: 0px;" class="">Maison de la Télédétection</div><div style="margin: 0px;" class="">500 rue Jean-François Breton</div><div style="margin: 0px;" class="">34093 Montpellier Cx 5</div><div style="margin: 0px;" class="">
France</div><div class=""><br class=""></div></div><div style="margin: 0px; font-family: Times;" class=""> « <i class="">Le socialisme vrai ne veut pas renverser l'ordre des classes ;</i></div><div style="margin: 0px; font-family: Times;
" class=""><i class=""> il veut fondre les classes dans une organisation du travail qui</i></div><div style="margin: 0px; font-family: Times;" class=""><i class=""> sera meilleure pour tous </i>»</div><div style="margin: 0px;
font-family: Times;" class=""> Jean Jaures - "Les misères du patronat" - 1890</div><div style="margin: 0px; font-size: 10px; font-family: "
Courier New";" class=""> _,'| _.-''``-...___..--';)</div><div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class=""> /_
\'. __..-' , ,--...--'''</div><div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class=""> <\ .`--''' ` /'</
<div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class=""> `-';' ; ; ;</div><div style="margin: 0px; font-size: 10px; font-family: "
Courier New";" class=""> __...--'' ___...--_..' .;.'</div><div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class="">(,__....----''' (,..--'' πr<
/div><div style="margin: 0px; font-family: Times; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; font-family: "Courier New";" class="">perl -e '$_=q#: 3|\ 5_,3-3,2_: 3/,`.'"'"'`'"'"' 5-. ;-;;,_: &
nbsp;|,A- ) )-,_. ,\ ( `'"'"'-'"'"': '"'"'-3'"'"'2(_/--'"'"' `-'"'"'\_): 24Ï€r::#;y#:#\n#;s#(\D)(\d+)#$1x$2#ge;print'</div><div style="margin: 0px; font-family: "Courier New";" class=""><span style="font-size: 10px;" class="">-
--> Ce message n’engage que son auteur <--</span></div></div></div></div></div></div>
</div>
<br class=""></div></body></html> --Apple-Mail=_F0D367FC-F2F8-4D20-A40B-EF103619DCDD--
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE0KHTJ+AWKhmI+acm/pSWHuad/BgFAmMfWrsACgkQ/pSWHuad /BgqsBAAmdeCAQI8snYxGyraX/hZwYwgxfY5u6v6uD05qXUxHJMwk9ovn9O3W+gs qQnvg+433ZsP05/ecH2oNzcqahMu29QQTUhQ8gxkpvvA7IXL8anlLg3Ugss/6VbB Ef9CCJo1igiW38suSGOTbZsb6hfGTUYk5+Hwr50gtw6veGDpGS4GOirNu/tJY3jm FxaEy64Hg9mWIPP66IaTf/H/pocv4WQorwEl427GSALj3WuTpASDq3GXoi2Fy/pb FxSrXCPn4ub7JfypaHe+cf8TV5Opd9g8jfbkC5J2w0hWixxGVCED4xlhAaH4YERR qoAstl2rv6gReyosZRw1nvHmnyNniZ25J0QMGBPujZmWKfN4bqJlch6WAwwfDYxV BLcw3Qrj2ww0IBTo0oVxfRpbj7rtd/kOG8JsPsDbkfv9DarFXVw3Ko+1HgIF+VQc SkPavAKbuc6evZiAIVXETl6jGOzpze4rJzL69kZyIknIVzkNPvkxd6QZWZK3pfYc P8f8yUYiYk8HlEHIDDKp84peNxdRtUdu2yw8Ss0XMjc5o6WfhTrT0yHlB91WxnCG X8dAliwrJcXfYVBCuEcLM/grx7PFydL9B/LorHPkgWGW3zQP8wUCcPKrR3+e/GCQ iXD2wvbgHbxpw0to1ymEp6JA7VO75xkgHOnNMMFdu2yqDf9CN8I=
=9YJW
-----END PGP SIGNATURE-----
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)