Jebat
Jebat

Reputation: 11

Sed manipulating text

I'm a novice in programming. I'm trying to remove * character in my text file using sed but to no avail, and keep getting this :

sed: -e expression #1, char 1: unknown command: `*'.

Please help?Thanks

Upvotes: 1

Views: 124

Answers (2)

vaishali
vaishali

Reputation: 335

You can also escape the shell meta characters by character class [] in sed

sed 's/[*]//g' filename

Upvotes: 0

Jake Stewart
Jake Stewart

Reputation: 41

The problem is that '*' is a special shell character and will be processed before the sed command. To combat this, use the escape character '\' before the '*' so it will be ignored by the shell and processed as a part of the sed command:

sed 's/\*//g' fileName

Upvotes: 3

Related Questions