-2

I want to delete a particular word from first line of a file using shell script

My test.txt is

# hello helloworld
Goodday
Goodbye

In this I want the bash code which edits test.txt to

 # helloworld
 Goodday
 Goodbye

I want to delete the string "hello" from the first line

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
Aravind
  • 41
  • 5
  • 1
    Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please learn how to create a [mcve] of *your own* attempt and show it to us, together with a description of the problems you have with it. – Some programmer dude Mar 10 '20 at 07:00
  • 2
    And if you work with shell scripts, why did you add the C and C++ tags? Please don't spam unrelated tags. – Some programmer dude Mar 10 '20 at 07:01
  • @Aravind: What did you try so far? – user1934428 Mar 10 '20 at 07:16

1 Answers1

0

Sed with the -i option is one way to do this - see https://www.gnu.org/software/sed/manual/sed.html

Chris
  • 1,644
  • 1
  • 11
  • 15