Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Comment faire un sed de "/" ?

Featured Replies

Posté(e)

Bonjour,

je souhaiterais savoir comment faire un sed de la ligne dessous qui se trouve dans un fichier nommé sauvegardes.txt

/pg_backup/pgiappli/appli/appli_20210411.gz

 

j'ai fait ceci:

sed 's/pg_backup//g' sauvegardes.txt | sed 's/pgiappli//g' | sed 's/appli//g' | sed 's/_//g' | sed 's/.gz//g'

 

résultat:

////20210411

 

Comment faire pour supprimer les "/" ?

Merci pour votre retour

jakol

 

 

 

 

 

 

Posté(e)
Il y a 18 minutes, jakol a écrit :

/pg_backup/pgiappli/appli/appli_20210411.gz

 

j'ai fait ceci:

sed 's/pg_backup//g' sauvegardes.txt | sed 's/pgiappli//g' | sed 's/appli//g' | sed 's/_//g' | sed 's/.gz//g'

 

résultat:

////20210411

 

Comment faire pour supprimer les "/" ?

En général, le caractère d'échappement \ permet de ne pas interpréter le caractère suivant.

Dans sa syntaxe, sed utilise les /

Donc sed /\///g va remplacer le '/'

Du coup, ta ligne devient:

 sed 's/\/pg_backup\/pgiappli\/appli\/appli_//g' sauvegardes.txt| sed 's/.gz//g

On peut faire mieux avec une capture:

sed -rn 's/\/pg_backup\/pgiappli\/appli\/appli_(.*).gz/\1/p' sauvegardes.txt


 

Modifié par brice.wernet

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.