Forrest logo
back to context overview

sed

List of commands for sed:

  • files:edit:remove:line-number Deletes the line number X from the file.txt
    $ sed -i 'Xd' ${filename}
    try on your machine
    explain this command
  • sed:ai:6206b how can i fix this line, if (fopen64::_fopen64 == (code *)0x0)
    $ sed -i 's/fopen64::_fopen64 == (code *)0x0/fopen64::_fopen64 == nullptr/g' your_file.c
    try on your machine
    explain this command
  • sed:ai:a06d4 Print lines x to y from file.txt
    $ sed -n 'x,yp' ${filename}
    try on your machine
    explain this command
  • sed:ai:b3792 command is used to replace the specific word, for Example:- we want to replace Timmy by Jimmy?
    $ sed -i 's/Timmy/Jimmy/g' ${filename}
    try on your machine
    explain this command
  • sed:ai:ce977 How to disable microcode check in needrestart
    $ sed -i 's/MICROCODE=yes/MICROCODE=no/' /etc/needrestart/needrestart.conf
    try on your machine
    explain this command
  • sed:ai:d2008 How do I change one line in multiple files
    $ sed -i 's/oldline/newline/g' file1.txt file2.txt file3.txt
    try on your machine
    explain this command
  • sed:ai:d6434 Remove current time from mermaid gantt chart
    $ sed 's/ "title": "Current time",//g' input.txt > output.txt
    try on your machine
    explain this command
  • sed:ai:e9184 How to rewrtie this line from c## to c, if (fopen64::_fopen64 == (code *)0x0)
    $ sed -i 's/fopen64::_fopen64/code *0x0/g' filename.c
    try on your machine
    explain this command
  • sed:tldr:33c7c sed: Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a `file` and save a backup of the original to `file.bak`.
    $ sed -i bak 's/apple/mango/g' ${filename}
    try on your machine
    explain this command
  • sed:tldr:4c349 sed: Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in all input lines and print the result to `stdout`.
    $ ${command} | sed 's/apple/mango/g'
    try on your machine
    explain this command
  • sed:tldr:7b149 sed: Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`.
    $ ${command} | sed -E 's/(apple)/\U\1/g'
    try on your machine
    explain this command
  • sed:tldr:ba741 sed: Execute a specific script [f]ile and print the result to `stdout`.
    $ ${command} | sed -f ${path-to-script-sed}
    try on your machine
    explain this command
  • sed:tldr:c733c sed: Print just a first line to `stdout`.
    $ ${command} | sed -n '1p'
    try on your machine
    explain this command
  • sed:tldr:d36c1 sed: Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a specific file and overwrite the original file in place.
    $ sed -i 's/apple/mango/g' ${filename}
    try on your machine
    explain this command
back to context overview