Sunday, April 28, 2024
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 8020  / 3 Years ago, thu, october 28, 2021, 10:22:56

I feel like a total newb. Why does this not work?



$ echo foobar > textfile
$ sed /foo/bar/ textfile
sed: can't find label for jump to `ar/'


I've also tried sed "/foo/bar/" textfile and sed '/foo/bar/' textfile, which all yields the same error.



Using ubuntu 8.04 and GNU sed version 4.1.5 through bash.


More From » command-line

 Answers
7

Try this: sed 's/foo/bar/' textfile.




  • Quotes around the statement are good practice

  • s for substitute. It is the command you want to execute. foo is the search term bar the replacement.



There is a lot of information on sed online. Eg.: http://www.catonmat.net/blog/sed-one-liners-explained-part-one/


[#39159] Friday, October 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
overine

Total Points: 20
Total Questions: 109
Total Answers: 98

Location: Aruba
Member since Fri, Jun 24, 2022
2 Years ago
overine questions
Tue, Jul 12, 22, 00:27, 2 Years ago
Wed, Jan 11, 23, 02:15, 1 Year ago
Tue, Aug 10, 21, 01:39, 3 Years ago
;