Print lines 1 to 20 without printing other lines.
sed -n '1,20p' app.logTransform text streams; this example prints matching lines without editing files.
sed [OPTION]... SCRIPT [FILE]...Print lines 1 to 20 without printing other lines.
sed -n '1,20p' app.logReplace every old occurrence on each line in the output.
sed 's/old/new/g' names.txt| Option / clause | Description |
|---|---|
-n, --quiet | Suppress automatic printing; use p to print selected lines. |
-E, -r, --regexp-extended | Use extended regular expressions. |
-e SCRIPT | Add a script to the commands to be executed. |
-f FILE | Read editing commands from FILE. |
-i[SUFFIX], --in-place | Edit files in place; an optional suffix keeps a backup. |
-z, --null-data | Separate input records with NUL characters. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.