Delete Set public Set private Add tags Delete tags
  Add tag   Cancel
  Delete tag   Cancel
  • • DevOps notes •
  •  
  • AI
  • Tags
  • Login

SED: Stream Editor for Text Manipulation/shaare/nqnEjg

  • linux
  • linux

  • Basic Replace Syntax:

    • sed -i 's/KENNY/LENNY/g' filename

    • Substitute all occurrences of "KENNY" with "LENNY"

  • Delete Line Containing String:

    • sed -i '/SEINFELD/d' filename
  • Delete Empty Lines:

    • sed -i '/^$/d' filename
  • Delete First Line:

    • sed '1d' filename
  • sed '1,2d' filename → delete the first two lines

  • sed 's/\t/ /g' filename → replace tabs with spaces

  • sed -n '12,18p' filename → print only lines 12 to 18

  • sed '12,18d' filename → delete lines 12 to 18

  • sed G filename → insert an empty line after every line

  • sed '8!s/seinfeld/S/' filename → replace "seinfeld" with "S" on every line except line 8

8 months ago Permalink
cluster icon
  • Filesystem check and disk cloning : fsck & xfs_repair → filesystem check fsck → ext2, ext3, ext4 xfs_repair → xfs only Made each boot & fix it df -T → check Unmount before fsck ...
  • Ldap Secure Ssh : Check on listening port netstat -tunlp → check open/listening port Securing SSH config more /etc/ssh/sshd_config change port 22 PermitRootLogin ...
  • Ftp Scp Rsync : FTP Install FTP server yum install vsftp nano /etc/vsftpd/vsftpd.conf anonymous_enable=NO Uncomment: ascii_upload_enable ascii_download_enabl...
  • Bash : First Line of Script #!/bin/bash → defines the shell interpreter Comments Use # for commenting Common Elements Commands: echo, cp, etc. Statement...
  • Vi Editor : Vi Editor Commands i → insert mode ESC → escape to command mode r → replace mode x → delete character dd → delete line yy → copy line p → paste v → v...


(97)
Filter untagged links
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community