Skip to content

Latest commit

 

History

History
14 lines (8 loc) · 366 Bytes

sed.md

File metadata and controls

14 lines (8 loc) · 366 Bytes

sed - stream editor for filtering and transforming text

Use submatch (aka capture group)

To replace

Replace all *VIRTIO*=m with *VIRTIO*=y:

$ sed -E -e 's/(.*VIRTIO.*)=m/\1=y/g' .config

To print only the submatch portion

$ sed -E -n -e 's/^Downstream port [1-3] is (ON|OFF)$/\1/p'