Re: [SLUG] need a command

From: Ronan Heffernan (ronanh@auctionsolutions.com)
Date: Wed Apr 07 2004 - 10:49:42 EDT


mrock wrote:

>With all due respect, the suggestions made do not work. I just recall
>seeing a special character that reverses the following selections when
>using sed. The result would be everything that does not fit the
>following criteria in the command.
>
>Michael C Rock
>
>

That 'special character' is the caret (^). The expression:
[0-9]
means match any of 0123456789. The expression:
[^0-9]
means match any charater except 0123456789. So to replace all characters
except 0123456789 with the letter 'x', you could do:

sed "s/[^0-9]/x/g" filename

To replace all instances of 0123456789 with the letter 'x', you could do:

sed "s/[0-9]/x/g" filename

--ronan

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:14:48 EDT