On Wed, 7 Apr 2004, Ronan Heffernan wrote:
> 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
How about
grep '^[0-9]*$' infile > tempfile
mv tempfile infile
or
grep -v '[^0-9]' infile > tempfile
mv tempfile infile
?
You might have to throw " .-," into those regexes.
-- -eben ebQenW1@EtaRmpTabYayU.rIr.OcoPm home.tampabay.rr.com/hactar Are you confident that you appear to be professional in your electronic communication? Consider this: A: No Q: Can I top post? from nick@xx.co.uk----------------------------------------------------------------------- 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:52 EDT