[Ilugc] How to delete multiple patterns from a text file easily?

  • From: knura9@xxxxxxxxx (Arun Khan)
  • Date: Sun, 8 Sep 2013 01:22:31 +0530

On Sat, Sep 7, 2013 at 11:58 PM, Shrinivasan T <tshrinivasan at gmail.com> 
wrote:

We need multiple strings replace in a text file.

Example.

Line one - 1
Line two - 2
Line three -3

Replace all 1,2,3 and - with space.

How to do this in a single command?

sed -e 's/[123-]/ /g'  <your_file_name>

remove the 'g' at the end if you want to replace only the first
instance (in the line).

-- 
Arun Khan
Sent from my non-iphone/non-android device
(???? ????/???? ???)

I'd rather be called a moron, than walk around with doubts in my mind.

Other related posts: