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
-----Original Message-----
From: slug@nks.net [mailto:slug@nks.net] On Behalf Of Ronan Heffernan
Sent: Wednesday, April 07, 2004 9:28 AM
To: slug@nks.net
Subject: Re: [SLUG] need a command
Levi Bard wrote:
>>I need to rid a numeric file of all lines that contain non-numeric
>>characters ie [0-9]. In other words I only want numbers in that file.
>>I think I recall seeing a sed statement that deleted anything except
>>0-9. I just don't recall the systax.
>>I have tried the ! thinking it would do the trick but it does not.
>>Can anyone help me with this?
>>
>>
>
>grep -v '[0-9]' file
>
>
No, that will give all of the lines that do contain numbers (but the
output will include the non-numeric characters. Try:
sed "s/[^0-9]//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 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:32 EDT