-3

The Data in the File1.txt is

Raj cmd
Rahul cmd
Pooja cmd
Vilas cmd
Vikram cmd

I want the Output to be Printed like this below

Raj
Rahul
Pooja
Vilas
Vikram

The Word I want to remove is "cmd"

jww
  • 97,681
  • 90
  • 411
  • 885
  • 1
    Pick a programming language or general text processing tool. As a new user, please take the [tour] and read [ask] as well. Also, don't blindly apply tags, read their description instead, and don't repeat tags in the title either. – Ulrich Eckhardt May 31 '19 at 10:30
  • [Remove occurrences of string in text file](https://stackoverflow.com/q/5998454/608639), [Sed find and delete single word](https://stackoverflow.com/q/15855735/608639), [How can I delete words from each line of a file using sed in shell script?](https://stackoverflow.com/q/43329477/608639), [How to replace multiple patterns at once with sed?](https://stackoverflow.com/q/26568952/608639), and friends. – jww May 31 '19 at 10:39
  • This looks like an [XY Problem](http://xyproblem.info/) question to me... – Paul Hodges May 31 '19 at 13:21

1 Answers1

-1

try this:

sed 's/\s*cmd//' File1.txt 

explanation

s/   # substitute
\s*  # ignore blanks
cmd  # your pattern
//   # replace with nothing
UtLox
  • 3,744
  • 2
  • 10
  • 13