0

I'm learning SED and I saw this sed substitution example. It's supposed to replace the first lowercase t as uppercase in each new line.:

$ sed 's/t/T' text-01.txt
  sed: -e expression #1, char 5: unterminated `s' command

Contents of file:

 $ cat text-01.txt
   10 tiny toes
   this is that
   5 funny 0
   one two three
   tree twice

It's not the end of the world though, since I can just output into a new file:

cat text-01.txt | sed 's/t/T/' > text-02.txt

But what am I supposed to do if I want to edit the original file?

1 Answers1

1

The commands aren't the same, the closing / is missing in the first one:

#                           v
                  sed 's/t/T' text-01.txt
cat text-01.txt | sed 's/t/T/' > text-02.txt
#                           ^
choroba
  • 231,213
  • 25
  • 204
  • 289