GNU bug report logs -
#21511
sed not performing as specified
Previous Next
Full log
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
On Fri, 18 Sep 2015 18:14:28 +1200, Beagleburt <bruce.gilbert <at> gmail.com>
wrote:
> I am doing an online course "Introduction to Linux"
> [image: edX] Home Page <https://www.edx.org> LinuxFoundationX: LFS101x.2
> Introduction to Linux
> Chapter 13: Manipulating Text; Section 2. sed & awk
>
> ~$ cat > test1
> This is a Sample Test File for the sed command.
> The sed command is used to edit contents in a file.
> For example, the sed command is used to replace words in a line or file.
> ~$ sed s/is/are/ test1
> Thare is a Sample Test File for the sed command.
> The sed command are used to edit contents in a file.
> For example, the sed command are used to replace words in a line or file.
>
> As you can see above the 1st instance of "is" in "This" is replaced by
> "are" giving "Thare"; BUT the following two lines also have "is" replaced
> by "are" EXCEPT for the "is" after "Thare". It is ALMOST as if I had
> invoked the global: sed s/is/are/g test1 EXCEPT for the 2nd "is" after
> "Thare"?
Sed replaces the first instance of "is" in each line with "are". Nothing
unexpected, no bug.
--
D.
This bug report was last modified 9 years and 299 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.