{"id":286,"date":"2010-11-23T09:49:04","date_gmt":"2010-11-23T09:49:04","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/11\/23\/unix-sed-quick-reference\/"},"modified":"2021-02-27T09:53:51","modified_gmt":"2021-02-27T09:53:51","slug":"unix-sed-quick-reference","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/","title":{"rendered":"Unix Sed Quick Reference"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4353\" src=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png\" alt=\"unix-sed-quick-reference\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png 600w, https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">UNIX SED Introduction<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoListParagraphCxSpFirst\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;\"><span style=\"color: #000000;\"><span style=\"font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;\"><span style=\"mso-list: Ignore;\"><span style=\"font-size: small;\">\u00b7<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Sed is a \u201cnon-interactive\u201d stream-oriented editor. Since its an \u201cnon-interactive\u201d it can be used to automate editing.<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;\"><span style=\"color: #000000;\"><span style=\"font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;\"><span style=\"mso-list: Ignore;\"><span style=\"font-size: small;\">\u00b7<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">This allows you to edit multiple files, or to perform common editing operations without opening VI or emacs.<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1;\"><span style=\"color: #000000;\"><span style=\"font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;\"><span style=\"mso-list: Ignore;\"><span style=\"font-size: small;\">\u00b7<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Sed reads from a file or from its standard input and outputs to its standard output.<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpLast\" style=\"text-indent: -0.25in; margin: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1;\"><span style=\"color: #000000;\"><span style=\"font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;\"><span style=\"mso-list: Ignore;\"><span style=\"font-size: small;\">\u00b7<\/span> <\/span><\/span><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"> Sed has two buffers which are called pattern buffer and hold buffer. Both are initially empty.<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">UNIX Sed Working Method<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri; color: #000000; font-size: small;\">This is called as one execution cycle. Cycle continues till end of file\/input is reached.<\/span><\/p>\n<p class=\"MsoListParagraphCxSpFirst\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;\"><span style=\"color: #000000;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"mso-list: Ignore;\"><span style=\"font-family: Calibri; font-size: small;\">1.<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Read a entire line from stdin\/file.<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;\"><span style=\"color: #000000;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"mso-list: Ignore;\"><span style=\"font-family: Calibri; font-size: small;\">2.<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Removes any trailing newline.<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;\"><span style=\"color: #000000;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"mso-list: Ignore;\"><span style=\"font-family: Calibri; font-size: small;\">3.<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Places the line, in its pattern buffer.<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpMiddle\" style=\"text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2;\"><span style=\"color: #000000;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"mso-list: Ignore;\"><span style=\"font-family: Calibri; font-size: small;\">4.<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Modify the pattern buffer according to the supplied commands<\/span><\/span><\/p>\n<p class=\"MsoListParagraphCxSpLast\" style=\"text-indent: -0.25in; margin: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo2;\"><span style=\"color: #000000;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"mso-list: Ignore;\"><span style=\"font-family: Calibri; font-size: small;\">5.<\/span> <\/span><\/span><span style=\"font-family: Calibri; font-size: small;\">Print the pattern buffer to stdout.<\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">Printing Operation in Sed<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri; color: #000000; font-size: small;\">Linux Sed command allows you to print only specific lines based on the line number or pattern matches. <strong style=\"mso-bidi-font-weight: normal;\">\u201cp\u201d <\/strong>is a command for printing the data from the pattern buffer.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">Syntax:<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\"># sed -n &#8216;ADDRESS&#8217;p filename<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt 0.5in;\"><span style=\"color: #000000;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"line-height: 115%;\"># sed -n &#8216;\/PATTERN\/p&#8217; filename<\/span><\/em><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri; color: #000000; font-size: small;\">Create the txt file <strong style=\"mso-bidi-font-weight: normal;\">sample.txt<\/strong> that will be used in all examples below.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\"># cat sample.txt<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">1. Linux &#8211; Sysadmin, Scripting etc.<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">2. Databases &#8211; Oracle, mySQL etc.<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">3. Hardware<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">4. Security (Firewall, Network, Online Security etc)<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">5. Storage<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">6. Cool gadgets and websites<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">7. Productivity (Too many technologies to explore)<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">8. Website Design<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">9. Software Development<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"line-height: 115%;\"><span style=\"color: #000000;\">10.Windows- Sysadmin, reboot etc.<\/span><\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">Sed Address Format 1: NUMBER<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri; color: #000000; font-size: small;\">This will only match Nth line in the input.<\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">#sed \u2013n \u2018N\u2019p filename<\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri; color: #000000; font-size: small;\">For example, 3p prints 3<sup>rd<\/sup> line of the input file sample.txt as below<\/span><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\"># sed -n &#8216;3&#8217;p thegeekstuff.txt<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt 0.5in;\"><span style=\"color: #000000;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"line-height: 115%;\">3. Hardware<\/span><\/em> <\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">Sed Address Format 2: NUMBER1~NUMBER2<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p><span style=\"color: #000000;\">M~N with \u201cp\u201d command prints every Nth line starting from line M.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018M~N\u2019p filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example, 3~2p prints every 2nd line starting from 3rd line as shown below.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '3~2'p thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">3. Hardware<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">5. Storage<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">7. Productivity (Too many technologies to explore)<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">9. Software Development<\/span><\/span><\/em><\/pre>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-outline-level: 3;\"><strong><span style=\"text-decoration: underline;\"><span style=\"mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">Sed Address Format 3: START,END<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;\"><span style=\"mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri; color: #000000; font-size: small;\">M,N with \u201cp\u201d command prints Mth line to Nth line.<br \/>\n<\/span><strong><br \/>\n<span style=\"font-family: Calibri; color: #000000; font-size: small;\"># sed -n \u2018M,N\u2019p filename<\/span><\/strong><\/span><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;\"><span style=\"mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">For example, 4,8p prints from 4th line to 8th line from input file thegeekstuff.txt<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\"># sed -n &#8216;4,8&#8217;p thegeekstuff.txt<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">4. Security (Firewall, Network, Online Security etc)<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">5. Storage<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">6. Cool gadgets and websites<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">7. Productivity (Too many technologies to explore)<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">8. Website Design<\/span><\/em><\/p>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Address Format 4: \u2018$\u2019 Last Line<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">$ with \u201cp\u201d command matches only the last line from the input.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018$\u2019p filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example, $p prints only the last line as shown below.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '$'p thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">10.Windows- Sysadmin, reboot etc.<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">\u00a0<\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Address Format 5: NUMBER,$<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">N,$ with \u201cp\u201d command prints from Nth line to end of file.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018N,$p\u2019 filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example 4,$p prints from 4th line to end of file.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '4,$p' thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">4. Security (Firewall, Network, Online Security etc)<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">5. Storage<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">6. Cool gadgets and websites<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">7. Productivity (Too many technologies to explore)<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">8. Website Design<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">9. Software Development<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">10.Windows- Sysadmin, reboot etc.<\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Pattern Format 1: PATTERN<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">PATTERN could be unix regular expression. The below command prints only the line which matches the given pattern.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \/PATTERN\/p filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example, following prints the line only which matches the pattern \u201cSysadmin\u201d.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n \/Sysadmin\/p thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">1. Linux - Sysadmin, Scripting etc.<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">10.Windows- Sysadmin, reboot etc.<\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Pattern Format 2: \/PATTERN\/,ADDRESS<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\"><strong># sed -n \u2018\/PATTERN\/,Np\u2019 filename<\/strong><\/span><\/p>\n<p><span style=\"color: #000000;\">For example, following prints lines which matches the pattern to Nth line, from input. 3rd line matches the pattern \u201cHardware\u201d, so it prints from 3rd line to 6th line.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '\/Hardware\/,6p' thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">3. Hardware<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">4. Security (Firewall, Network, Online Security etc)<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">5. Storage<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">6. Cool gadgets and websites<\/span><\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Pattern Format 3: ADDRESS,\/PATTERN\/<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">It prints from the Nth line of the input, to the line which matches the pattern. If the pattern doesnt match, it prints upto end of the input.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018N,\/PATTERN\/p\u2019 filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example, 4th line matches the pattern \u201cSecurity\u201d, so it prints from 3rd line to 4th line.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '3,\/Security\/p' thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">3. Hardware<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">4. Security (Firewall, Network, Online Security etc)<\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Pattern Format 4: \/PATTERN\/,$<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">It prints from the line matches the given pattern to end of file.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018\/PATTERN\/,$p\u2019 filename<\/span><\/strong><\/strong><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '\/Website\/,$p' thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">8. Website Design<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">9. Software Development<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">10.Windows- Sysadmin, reboot etc.<\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Pattern Format 5: \/PATTERN\/,+N<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">It prints the lines which matches the pattern and next N lines following the matched line.<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018\/PATTERN\/,+Np\u2019 filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example, following prints the 5th line which matches the pattern \/Storage\/ and next two lines following \/Storage\/.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '\/Storage\/,+2p' thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">5. Storage<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">6. Cool gadgets and websites<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">7. Productivity (Too many technologies to explore)<\/span><\/em><\/pre>\n<h3 style=\"margin: auto 0in;\"><span style=\"text-decoration: underline;\"><span style=\"color: #000000;\">Sed Pattern Format 6: \/PATTERN\/,\/PATTERN\/<\/span><\/span><\/h3>\n<p><span style=\"color: #000000;\">Prints the section of file between two regular expression (including the matched line ).<br \/>\n<\/span><strong><br \/>\n<strong><span style=\"color: #000000;\"># sed -n \u2018\/P1\/,\/P2\/p\u2019 filename<\/span><\/strong><\/strong><\/p>\n<p><span style=\"color: #000000;\">For example, 5th line matches \u201cStorage\u201d and 8th line matches \u201cDesign\u201d, so it prints 5th to 8th.<\/span><\/p>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\"># sed -n '\/Storage\/,\/Design\/p' thegeekstuff.txt<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">5. Storage<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">6. Cool gadgets and websites<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: x-small;\"><span style=\"font-family: Courier New;\">7. Productivity (Too many technologies to explore)<\/span><\/span><\/em><\/pre>\n<pre style=\"margin-left: 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-family: Courier New; font-size: x-small;\">8. Website Design<\/span><\/em><\/pre>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"line-height: 115%; font-size: 12pt;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">Delete File Lines Using Address and pattern in Sed<\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"line-height: 115%; font-size: 12pt;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">\u201cp\u201d command prints the buffer (Remember to use \u201c-n\u201d option with \u201cp\u201d)<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"line-height: 115%; font-size: 12pt;\"><span style=\"font-family: Calibri;\"><span style=\"color: #000000;\">\u201cd\u201d command is just opposite, it\u2019s for deletion. \u201cd\u201d will delete the pattern space buffer and immediately starts the next cycle.<\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\">Syntax:<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"line-height: normal; margin: 0in 0in 0pt 0.5in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"color: #000000;\"># sed &#8216;ADDRESS&#8217;d filename<\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt 0.5in;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"line-height: 115%;\"><span style=\"color: #000000;\"># sed \/PATTERN\/d filename<\/span><\/span><\/em><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">Delete the Nth line.<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">\u201cNd\u201d delete the Nth line and prints the other lines.<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">For example, 3d deletes 3<sup>rd<\/sup> line and prints other lines.<\/span><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed 3d sample.txt<\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">Delete Starting from 3<sup>rd<\/sup> line and every 2<sup>nd<\/sup> line from there.<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed \u20183~2d\u2019 sample.txt<\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\">Delete from 4ht to 8<sup>th<\/sup> line from file<\/span><\/span><\/strong><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed \u20184,8d\u2019 sample.txt<\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">Delete the last line from input<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed \u2018$d\u2019 sample.txt<\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\">Delete the line which matches the given pattern from input<\/span><\/span><\/strong><\/span><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed \/Sysadmin\/d sample.txt <\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">Delete the line from which matches the given pattern to end of the file<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed \u2018\/Website\/ ,$d\u2019 sample.txt<\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">Delete the line from which matches the given pattern and 2 lines next to that<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> <em style=\"mso-bidi-font-style: normal;\">$sed \u2018Storage\/ ,+2d\u2019 sample.txt<\/em><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><strong style=\"mso-bidi-font-weight: normal;\"><span style=\"text-decoration: underline;\"><span style=\"mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;\"><span style=\"font-family: Calibri;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\">Delete blank line from a file using sed.<\/span><\/span><\/span><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"margin: 0in 0in 10pt;\"><em style=\"mso-bidi-font-style: normal;\"><span style=\"font-size: small;\"><span style=\"color: #000000;\"> $sed \u2018\/^$\/d\u2019 sample.txt<\/span><\/span><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UNIX SED Introduction \u00b7 Sed is a \u201cnon-interactive\u201d stream-oriented editor. Since its an \u201cnon-interactive\u201d it can be used to automate [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":4353,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[528],"tags":[4084,2540,938,4080,169,4081,4088,4086,4082,4085,4083,4087],"class_list":["post-286","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unix-linux-operating-systems","tag-introduction-of-unix-sed","tag-quick","tag-reference","tag-sed","tag-unix","tag-unix-sed","tag-unix-sed-command","tag-unix-sed-guide","tag-unix-sed-introduction","tag-unix-sed-overview","tag-unix-sed-working-method","tag-what-is-unix-sed"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Unix Sed Quick Reference - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unix Sed Quick Reference - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"UNIX SED Introduction \u00b7 Sed is a \u201cnon-interactive\u201d stream-oriented editor. Since its an \u201cnon-interactive\u201d it can be used to automate [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2010-11-23T09:49:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-27T09:53:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"scmgalaxy K\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"scmgalaxy K\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/\"},\"author\":{\"name\":\"scmgalaxy K\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"headline\":\"Unix Sed Quick Reference\",\"datePublished\":\"2010-11-23T09:49:04+00:00\",\"dateModified\":\"2021-02-27T09:53:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/\"},\"wordCount\":848,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/unix-sed-quick-reference.png\",\"keywords\":[\"Introduction of Unix Sed\",\"Quick\",\"Reference\",\"Sed\",\"unix\",\"Unix Sed\",\"Unix sed command\",\"Unix Sed Guide\",\"UNIX SED Introduction\",\"Unix Sed Overview\",\"UNIX Sed Working Method\",\"What is Unix sed\"],\"articleSection\":[\"Unix \\\/ Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/\",\"name\":\"Unix Sed Quick Reference - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/unix-sed-quick-reference.png\",\"datePublished\":\"2010-11-23T09:49:04+00:00\",\"dateModified\":\"2021-02-27T09:53:51+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/unix-sed-quick-reference.png\",\"contentUrl\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/unix-sed-quick-reference.png\",\"width\":600,\"height\":400,\"caption\":\"unix-sed-quick-reference\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/unix-sed-quick-reference\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unix Sed Quick Reference\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/fc12ad190f540e79460243c81148d102\",\"name\":\"scmgalaxy K\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g\",\"caption\":\"scmgalaxy K\"},\"sameAs\":[\"http:\\\/\\\/www.DevOpsSchool.com\"],\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/scmgalaxy\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unix Sed Quick Reference - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/","og_locale":"en_US","og_type":"article","og_title":"Unix Sed Quick Reference - scmGalaxy","og_description":"UNIX SED Introduction \u00b7 Sed is a \u201cnon-interactive\u201d stream-oriented editor. Since its an \u201cnon-interactive\u201d it can be used to automate [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/","og_site_name":"scmGalaxy","article_published_time":"2010-11-23T09:49:04+00:00","article_modified_time":"2021-02-27T09:53:51+00:00","og_image":[{"width":600,"height":400,"url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png","type":"image\/png"}],"author":"scmgalaxy K","twitter_card":"summary_large_image","twitter_misc":{"Written by":"scmgalaxy K","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/"},"author":{"name":"scmgalaxy K","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"headline":"Unix Sed Quick Reference","datePublished":"2010-11-23T09:49:04+00:00","dateModified":"2021-02-27T09:53:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/"},"wordCount":848,"commentCount":0,"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png","keywords":["Introduction of Unix Sed","Quick","Reference","Sed","unix","Unix Sed","Unix sed command","Unix Sed Guide","UNIX SED Introduction","Unix Sed Overview","UNIX Sed Working Method","What is Unix sed"],"articleSection":["Unix \/ Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/","name":"Unix Sed Quick Reference - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#primaryimage"},"image":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#primaryimage"},"thumbnailUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png","datePublished":"2010-11-23T09:49:04+00:00","dateModified":"2021-02-27T09:53:51+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#primaryimage","url":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png","contentUrl":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/11\/unix-sed-quick-reference.png","width":600,"height":400,"caption":"unix-sed-quick-reference"},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/unix-sed-quick-reference\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Unix Sed Quick Reference"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/fc12ad190f540e79460243c81148d102","name":"scmgalaxy K","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b902ea8c77ee0a326c112f29d0edf51b7c3e1cd05c4fb92a810177e9c3f12a9?s=96&d=mm&r=g","caption":"scmgalaxy K"},"sameAs":["http:\/\/www.DevOpsSchool.com"],"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/scmgalaxy\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":3,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"predecessor-version":[{"id":4355,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/286\/revisions\/4355"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media\/4353"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}