Afficher un message
Vieux 27/05/2007, 20h14   #2
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: removing rogue characters with sed

On 2007-05-27, waffle.horn@googlemail.com wrote:
> Hi all,
>
> Im trying to remove two types of rogue characters but I can't seem to
> think of the correct solution with sed. The characters Im trying to
> remove are the @ and ` characters shown below
>
> -0.1000@-0.1000
>
> -0.1000`-0.1000
>
> I have tried...
>
> sed 's/@/ /' FILENAME | sed 's/`/ /'
>
> It doesn't seem to work for all instances.


Presumably, those instances are where there's more than one such
character on a line. For that you need to use global substitution
(and you can do it with a single call to sed):

sed -e 's/@/ /g' -e 's/`/ /g' FILENAME

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
 
Page generated in 0,04483 seconds with 9 queries