Re: [SLUG] need a command

From: Ronan Heffernan (ronanh@auctionsolutions.com)
Date: Wed Apr 07 2004 - 09:28:07 EDT


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 archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:14:25 EDT