<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Sed-Stream-Editor%2FC2%2FSed-special-characters%2FEnglish</id>
		<title>Sed-Stream-Editor/C2/Sed-special-characters/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Sed-Stream-Editor%2FC2%2FSed-special-characters%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;action=history"/>
		<updated>2026-05-13T15:05:22Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;diff=54852&amp;oldid=prev</id>
		<title>Nirmala Venkat at 09:07, 16 February 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;diff=54852&amp;oldid=prev"/>
				<updated>2021-02-16T09:07:05Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:07, 16 February 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 112:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 112:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Highlight $&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Highlight $&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| This '''command''' with a '''special character dollar($)''' &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;matches &lt;/del&gt;the last line of the file.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| This '''command''' with a '''special character dollar($)''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;prints &lt;/ins&gt;the last line of the file.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| &amp;gt;'''sed -n ‘4, $p’ IndianBooks.txt'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|| &amp;gt;'''sed -n ‘4, $p’ IndianBooks.txt'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nirmala Venkat</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;diff=54845&amp;oldid=prev</id>
		<title>Nancyvarkey at 07:49, 15 February 2021</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;diff=54845&amp;oldid=prev"/>
				<updated>2021-02-15T07:49:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;amp;diff=54845&amp;amp;oldid=54733&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Nancyvarkey</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;diff=54733&amp;oldid=prev</id>
		<title>Nirmala Venkat: Created page with &quot;  {| border=&quot;1&quot; |- || '''VISUAL CUE''' || '''NARRATION''' |- || '''Slide 1:''' || Welcome to the '''spoken tutorial '''on '''Sed special characters.''' |- || '''Slide 2:'''  '...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Sed-Stream-Editor/C2/Sed-special-characters/English&amp;diff=54733&amp;oldid=prev"/>
				<updated>2021-01-19T10:38:05Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;  {| border=&amp;quot;1&amp;quot; |- || &amp;#039;&amp;#039;&amp;#039;VISUAL CUE&amp;#039;&amp;#039;&amp;#039; || &amp;#039;&amp;#039;&amp;#039;NARRATION&amp;#039;&amp;#039;&amp;#039; |- || &amp;#039;&amp;#039;&amp;#039;Slide 1:&amp;#039;&amp;#039;&amp;#039; || Welcome to the &amp;#039;&amp;#039;&amp;#039;spoken tutorial &amp;#039;&amp;#039;&amp;#039;on &amp;#039;&amp;#039;&amp;#039;Sed special characters.&amp;#039;&amp;#039;&amp;#039; |- || &amp;#039;&amp;#039;&amp;#039;Slide 2:&amp;#039;&amp;#039;&amp;#039;  &amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|| '''VISUAL CUE'''&lt;br /&gt;
|| '''NARRATION'''&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide 1:'''&lt;br /&gt;
|| Welcome to the '''spoken tutorial '''on '''Sed special characters.'''&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide 2:'''&lt;br /&gt;
&lt;br /&gt;
'''Learning Objectives'''&lt;br /&gt;
|| In this tutorial, we will learn about:&lt;br /&gt;
* Print command &lt;br /&gt;
&lt;br /&gt;
Also, how to use special characters such as&lt;br /&gt;
*$ (dollar) &lt;br /&gt;
*^ (caret)&lt;br /&gt;
*= (equal to) &lt;br /&gt;
*&amp;amp;(ampersand) &lt;br /&gt;
in '''Sed''' command.&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide 3:'''&lt;br /&gt;
&lt;br /&gt;
'''System requirements'''&lt;br /&gt;
|| This tutorial is recorded using&lt;br /&gt;
*'''Ubuntu Linux '''OS version 18.04 &lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide 4:'''&lt;br /&gt;
&lt;br /&gt;
'''Prerequisites'''&lt;br /&gt;
|| To follow this tutorial, you should know&lt;br /&gt;
* Basics of Linux.&lt;br /&gt;
&lt;br /&gt;
If not, for relevant tutorials please visit our website:&lt;br /&gt;
|-&lt;br /&gt;
|| Slide 5:&lt;br /&gt;
&lt;br /&gt;
Code files – '''IndianBooks'''.txt&lt;br /&gt;
|| *The files used in this tutorial are available in the '''Code Files '''link on this tutorial page.&lt;br /&gt;
*Please download and extract them&lt;br /&gt;
*Make a copy and then use them while practicing&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Open the terminal&lt;br /&gt;
|| Open the terminal by pressing '''Ctrl+Alt+T''' keys simultaneously.&lt;br /&gt;
&lt;br /&gt;
Press the enter key after every command.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt; cd Downloads&lt;br /&gt;
&lt;br /&gt;
&amp;gt; cat '''IndianBooks'''&lt;br /&gt;
|| Let us see the content of the file '''IndianBooks.txt '''which I have saved in the Downloads folder.&lt;br /&gt;
&lt;br /&gt;
Type '''cat space IndianBooks.txt'''&lt;br /&gt;
&lt;br /&gt;
In this tutorial, I’ll be using this file for demonstration.&lt;br /&gt;
|-&lt;br /&gt;
| padding-left:0.206cm;padding-right:0.191cm;color:#000000;&amp;quot; | Print command&lt;br /&gt;
|| First we will learn about '''print''' command.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed ‘p’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight p&lt;br /&gt;
|| Type &lt;br /&gt;
&lt;br /&gt;
'''sed space within single quotes p space IndianBooks.txt'''&lt;br /&gt;
&lt;br /&gt;
“p” is the command for printing the data from the pattern buffer.&lt;br /&gt;
&lt;br /&gt;
In the output, we can see that each line is displayed twice.&lt;br /&gt;
&lt;br /&gt;
Recall the workflow of '''Sed'''.&lt;br /&gt;
&lt;br /&gt;
By default, '''Sed''' prints the content of the pattern buffer. &lt;br /&gt;
&lt;br /&gt;
We have included the print option ‘p’ in the above command. So it prints twice.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed -n ‘p’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight -n&lt;br /&gt;
|| Use -n to suppress the default printing of the pattern buffer.&lt;br /&gt;
&lt;br /&gt;
Type the command with -n as shown.&lt;br /&gt;
&lt;br /&gt;
-n (hyphen n) is the '''Sed''' command line flag.&lt;br /&gt;
|-&lt;br /&gt;
|| Address range&lt;br /&gt;
&lt;br /&gt;
&amp;gt; sed -n ‘5p’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight 5p&lt;br /&gt;
|| Let us see how '''Sed''' operates on a particular line.&lt;br /&gt;
&lt;br /&gt;
Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
5p prints the fifth line of the input file '''IndianBooks.txt'''&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt; sed -n ‘3,6 p’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight 3,6p&lt;br /&gt;
|| Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
Here we have specified an address range in the '''Sed''' command.&lt;br /&gt;
&lt;br /&gt;
This will print from the 3rd line to the 6th line .&lt;br /&gt;
|-&lt;br /&gt;
|| $ command&lt;br /&gt;
|| Next we will see how to use the special character dollar($) in '''Sed''' command.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt; sed -n ‘$p’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight $&lt;br /&gt;
|| This command with a special character dollar matches the last line of the file.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;'''sed -n ‘4, $p’ IndianBooks.txt'''&lt;br /&gt;
|| We can use the $ character to specify the address range.&lt;br /&gt;
&lt;br /&gt;
Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
This command prints from the 4th line to the last line&lt;br /&gt;
|-&lt;br /&gt;
|| + operator&lt;br /&gt;
&lt;br /&gt;
&amp;gt; sed -n ‘3, +3p’ IndianBooks.txt&lt;br /&gt;
|| Next we will see how to use + operator in the address range.&lt;br /&gt;
&lt;br /&gt;
Type the command with + operator as shown.&lt;br /&gt;
&lt;br /&gt;
This command prints the next 3 lines starting from the third line.&lt;br /&gt;
|-&lt;br /&gt;
|| ~ operator&lt;br /&gt;
&amp;gt; sed -n ‘1~2p’ IndianBooks.txt&lt;br /&gt;
|| We can use the tilde(~) operator to specify the address range.&lt;br /&gt;
&lt;br /&gt;
For example, this command prints the odd line numbers from the file.&lt;br /&gt;
&lt;br /&gt;
That is, it starts from line number 1 and processes every 2&amp;lt;sup&amp;gt;nd&amp;lt;/sup&amp;gt; line.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed -n ‘2~2 p’ IndianBooks.txt&lt;br /&gt;
|| Type this command to print only the even numbers from the file.&lt;br /&gt;
|-&lt;br /&gt;
|| Pattern range&lt;br /&gt;
&amp;gt;sed -n ‘ /Gandhi/ p’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight between forward slash&lt;br /&gt;
|| Next we will see how '''Sed''' command handles with the pattern range.&lt;br /&gt;
Type '''sed space hyphen n space within single quotes forward slash Gandhi forward slash p space IndianBooks.txt'''&lt;br /&gt;
&lt;br /&gt;
Note that pattern has to be specified within forward slashes.&lt;br /&gt;
&lt;br /&gt;
'''Sed''' operates on each line and prints only those lines that match the string '''Gandhi'''.&lt;br /&gt;
|-&lt;br /&gt;
|| '''&amp;gt; sed -n’/Gandhi/!p’ IndianBooks.txt'''&lt;br /&gt;
&lt;br /&gt;
'''Highlight ! operator'''&lt;br /&gt;
|| We can reverse the above command.&lt;br /&gt;
&lt;br /&gt;
We can print the lines that don’t contain the word '''Gandhi'''.&lt;br /&gt;
&lt;br /&gt;
Use negation operator as shown here and see the output.&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
|| Next we will see about a few other special characters used in regular expressions.&lt;br /&gt;
|-&lt;br /&gt;
|| Character Description&lt;br /&gt;
&lt;br /&gt;
^ Matches the beginning of the line&lt;br /&gt;
&lt;br /&gt;
$ Matches the end of the line&lt;br /&gt;
&lt;br /&gt;
. Matches any single character&lt;br /&gt;
&lt;br /&gt;
* Matches zero or more occurrences &lt;br /&gt;
&lt;br /&gt;
[ ] Matches all the characters inside the [ ]&lt;br /&gt;
|| &lt;br /&gt;
&lt;br /&gt;
Caret matches the beginning of the line&lt;br /&gt;
&lt;br /&gt;
Dollar matches the end of the line&lt;br /&gt;
&lt;br /&gt;
Dot matches any single character&lt;br /&gt;
&lt;br /&gt;
Asterisk matches zero or more occurrences&lt;br /&gt;
&lt;br /&gt;
Square brackets matches all the characters inside it&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
|| Let us see how these special characters work with the '''sed''' commands.&lt;br /&gt;
|-&lt;br /&gt;
|| (^) start of line&lt;br /&gt;
&lt;br /&gt;
'''&amp;gt; sed -n ‘/^1/ p’ IndianBooks.txt'''&lt;br /&gt;
|| Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
This command prints all the lines that starts with the pattern ‘1’ (one)&lt;br /&gt;
&lt;br /&gt;
The caret(^) symbol matches the start of a line.&lt;br /&gt;
|-&lt;br /&gt;
|| ($) end of line&lt;br /&gt;
&lt;br /&gt;
'''&amp;gt;sed -n ‘/3$/ p’ IndianBooks.txt'''&lt;br /&gt;
|| In this command, the end of the line pattern is denoted by the dollar($) symbol.&lt;br /&gt;
&lt;br /&gt;
This command prints all the lines that end with the pattern ‘3’.&lt;br /&gt;
|-&lt;br /&gt;
|| (.) single character&lt;br /&gt;
&lt;br /&gt;
'''&amp;gt;sed -n ‘/...8$/ p’ IndianBooks.txt'''&lt;br /&gt;
|| Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
Dot matches any single character.&lt;br /&gt;
&lt;br /&gt;
This command prints all the four letter text that ends with 8.&lt;br /&gt;
|-&lt;br /&gt;
|| (*)&lt;br /&gt;
&amp;gt;sed -n '/Ind*/ p' IndianBooks.txt&lt;br /&gt;
|| Let us see an example for Asterisks.&lt;br /&gt;
&lt;br /&gt;
Asterisks (*) matches the zero or more occurrence of the preceding character.&lt;br /&gt;
&lt;br /&gt;
This prints the line that matches &amp;quot;India&amp;quot;, &amp;quot;Indira&amp;quot; and so on.&lt;br /&gt;
|-&lt;br /&gt;
|| = (equal to)&lt;br /&gt;
|| Next we will see how to use equal to command.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed ‘=’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight =&lt;br /&gt;
|| Type as shown.&lt;br /&gt;
&lt;br /&gt;
Equal to command is used to print line numbers in standard output.&lt;br /&gt;
&lt;br /&gt;
We can see the line number followed by the content.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt; sed ‘1,5=’ IndianBooks.txt&lt;br /&gt;
|| Type the command with address range as shown.(6:48)&lt;br /&gt;
&lt;br /&gt;
This prints the line numbers for the first 5 lines and the remaining without the line numbers.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed ‘/Nehru/ =’ IndianBooks.txt&lt;br /&gt;
|| This command prints the line numbers with respect to the pattern match.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed -n '/My/ =' IndianBooks.txt&lt;br /&gt;
|| How to find out the line numbers that contain a pattern?&lt;br /&gt;
&lt;br /&gt;
Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
This prints only the line numbers of the line that has the pattern ‘'''My'''’&lt;br /&gt;
|-&lt;br /&gt;
|| sed -n '$=' IndianBooks.txt&lt;br /&gt;
|| Next let us find the number of lines in a file.&lt;br /&gt;
&lt;br /&gt;
Type the command as shown and see the output.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;amp; command:&lt;br /&gt;
&lt;br /&gt;
sed 's/^.*/(&amp;amp;)/' IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
sed 's/^.*dhi/(&amp;amp;)/' IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
|| Next we will see how to use ampersand in '''Sed''' command.&lt;br /&gt;
&lt;br /&gt;
Type the command.&lt;br /&gt;
&lt;br /&gt;
When &amp;amp; is used in the search string, it replaces with whatever text matches the original-string.&lt;br /&gt;
&lt;br /&gt;
This command inserts parentheses in all the lines.&lt;br /&gt;
&lt;br /&gt;
Let’s see another example.&lt;br /&gt;
&lt;br /&gt;
This command puts parentheses around the matched text which ends with ‘dhi’.&lt;br /&gt;
|-&lt;br /&gt;
|| Slide:&lt;br /&gt;
&lt;br /&gt;
[] regular expression:&lt;br /&gt;
&lt;br /&gt;
Character class Description&lt;br /&gt;
&lt;br /&gt;
[:alnum:] Alphanumeric [a-z A-Z 0-9]&lt;br /&gt;
&lt;br /&gt;
[:alpha:] Alphabetic [a-z A-Z]&lt;br /&gt;
&lt;br /&gt;
[:blank:] Spaces or tabs&lt;br /&gt;
&lt;br /&gt;
[:digit:] Numeric digits [0-9]&lt;br /&gt;
&lt;br /&gt;
[:lower:] Lower-case [a-z]&lt;br /&gt;
&lt;br /&gt;
[:space:] Whitespace&lt;br /&gt;
&lt;br /&gt;
[:upper:] Upper-case [A-Z]&lt;br /&gt;
|  | The square bracket regular expression has some more additional options as shown here.&lt;br /&gt;
&lt;br /&gt;
Let us see a few examples on how to use these in regular expression.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed 's/[Tt]ruth/TRUTH/' IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight the output&lt;br /&gt;
|| &lt;br /&gt;
&lt;br /&gt;
Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
In regular expression terminology, a character set is represented by square brackets.&lt;br /&gt;
&lt;br /&gt;
This command matches the pattern &amp;quot;Truth&amp;quot; with capital T and small ‘t’. &lt;br /&gt;
&lt;br /&gt;
Then it replaces the word with TRUTH, all in capital letters.&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
sed 's/19[0-9]*/****/' IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight 19[0-9]&lt;br /&gt;
&lt;br /&gt;
Highlight ****&lt;br /&gt;
&lt;br /&gt;
Highlight the output&lt;br /&gt;
&lt;br /&gt;
|| Next we will see how the character range is specified with hyphen.&lt;br /&gt;
&lt;br /&gt;
Type the command as shown.&lt;br /&gt;
&lt;br /&gt;
Note this regular expression.&lt;br /&gt;
&lt;br /&gt;
It should match with the string starting with nineteen and any character within the range 0 to 9.&lt;br /&gt;
&lt;br /&gt;
Then it is replaced with 4 asterisks.&lt;br /&gt;
&lt;br /&gt;
In the output, we can see all the published years are replaced with 4 asterisks.&lt;br /&gt;
|-&lt;br /&gt;
|| &amp;gt;sed ‘s/[[:digit:]]/Book no &amp;amp;/’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight s&lt;br /&gt;
&lt;br /&gt;
Highlight the output&lt;br /&gt;
|| Let us see the '''digit''' character class in '''Sed''' command.&lt;br /&gt;
&lt;br /&gt;
Here, the digit represents number 0 to 9 as the search pattern.&lt;br /&gt;
&lt;br /&gt;
This command adds the text ‘Book No’ at the beginning of each line.&lt;br /&gt;
|-&lt;br /&gt;
|| Cat IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
HIghlight year&lt;br /&gt;
&lt;br /&gt;
&amp;gt; sed ‘s/[[:digit:]]*$/Published on: &amp;amp;/’ IndianBooks.txt&lt;br /&gt;
&lt;br /&gt;
Highlight '''[[:digit:]]*$'''&lt;br /&gt;
&lt;br /&gt;
|| Let us see another example.&lt;br /&gt;
&lt;br /&gt;
In '''IndianBooks.txt''' , the last entry is the published year.&lt;br /&gt;
&lt;br /&gt;
Let us add the word “Published on” before the year.&lt;br /&gt;
&lt;br /&gt;
Type the command as shown:&lt;br /&gt;
&lt;br /&gt;
This command''' '''finds the last occurrence of the digit and replaces with '''‘Published on:’'''&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
|| With this we come to the end of this tutorial. Let us summarize.&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
&lt;br /&gt;
Slide 8:&lt;br /&gt;
&lt;br /&gt;
Summary&lt;br /&gt;
|| In this tutorial, we learnt:*Print command &lt;br /&gt;
*special characters such as&lt;br /&gt;
*$ (dollar) &lt;br /&gt;
*^ (caret)&lt;br /&gt;
*= (equal to) &lt;br /&gt;
*&amp;amp;(ampersand) &lt;br /&gt;
in '''Sed''' command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|| Slide:9&lt;br /&gt;
&lt;br /&gt;
Assignment&lt;br /&gt;
|| As an Assignment, try the below commands and see the output.&lt;br /&gt;
# '''sed''' 's/Indi.*/****/' IndianBooks.txt&lt;br /&gt;
# '''sed''' 's/Indi[a-z]*a/****/' IndianBooks.txt&lt;br /&gt;
|-&lt;br /&gt;
|| Slide 10:&lt;br /&gt;
&lt;br /&gt;
(About Spoken Tutorial Project)&lt;br /&gt;
|  | The video at the following link, summarizes the''' Spoken Tutorial '''project.&lt;br /&gt;
&lt;br /&gt;
Please download and watch it.&lt;br /&gt;
|-&lt;br /&gt;
|| Slide 11:&lt;br /&gt;
&lt;br /&gt;
(About Spoken Tutorial Project)&lt;br /&gt;
|| The '''Spoken Tutorial''' Project Team conducts workshops and gives certificates.&lt;br /&gt;
&lt;br /&gt;
For more details, please write to us.&lt;br /&gt;
|-&lt;br /&gt;
|| Slide&lt;br /&gt;
&lt;br /&gt;
Forum questions:&lt;br /&gt;
||&lt;br /&gt;
*Do you have questions in THIS Spoken Tutorial?&lt;br /&gt;
*Please visit this site&lt;br /&gt;
*Choose the minute and second where you have the question&lt;br /&gt;
*Explain your question briefly&lt;br /&gt;
*The Spoken Tutorial project team will ensure an answer&lt;br /&gt;
*You will have to register on this website to ask questions.&lt;br /&gt;
|-&lt;br /&gt;
|| '''Slide: '''Acknowledgement&lt;br /&gt;
&lt;br /&gt;
|| Spoken Tutorial project is funded by the Ministry of Education (MoE), Govt. of India.&lt;br /&gt;
|-&lt;br /&gt;
|| &lt;br /&gt;
|| This is Pooja from Spoken tutorials, IIT Bombay signing off.&lt;br /&gt;
Thanks for joining.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Nirmala Venkat</name></author>	</entry>

	</feed>