to seperate between number and alphabet characters

to seperate between number and alphabet characters

Post by KA MOHD-NAS » Sat, 03 Jun 1995 04:00:00



Hi awk users,

I am quite new to awk programming. I have a problem. I want to seperate between number
character and alphabet character from a data file that I obtained as an output from
a program. The sample output is shown below;
____________________________________________________________________________________
nrows, ncols, cell size: 14 29 152.439024
rowout, colout, sout:-29 -40 0.000800
simulating spatially distributed roughness
simulating spatially distributed raingage rainfall data
infiltration is computed
computational time step (sec), total simulation time (sec), and rainfall duration (sec):  60.00 5000 720

  Time (min)   Discharge (cms)
    1.00       3.21 58.7715
    2.00       3.21 58.7715
    3.00       3.21 58.7715
    4.00       3.21 58.7715
    5.00       3.21 58.7715
    6.00       3.21 58.7715
    7.00       3.21 58.7715
    8.00       3.21 58.7715
    9.00       3.21 58.7715
   10.00       3.21 58.7715
   11.00       3.21 58.7715
   12.00       3.21 58.7715
   13.00       3.21 58.7715
   14.00       3.21 58.7715
   15.00       3.21 58.7715
   16.00       3.21 58.7715
   17.00       3.21 58.7715
   18.00       3.21 58.7715
   19.00       3.21 58.7715
   20.00       3.21 58.7715
   21.00       3.21 58.7715
_____________________________________________________________________________________
I would like to print only the number character and I wrote a short awk programme as
shown below;
************************************************************************************
BEGIN{
decimal = "[0-9]+[.]?[0-9]*"
fraction = "[.] [0-9]+"
number = "^" decimal fraction
$0 ~ number

Quote:}

 {print}
*************************************************************************************
However, I got the following error message, and I don't know what it is;
awk: syntax error near line 5
awk: illegal statement near line 5

Can anyone help point out what I am missing here.
Sorry, to post this problem to the netters since some of you might find it very easy.

Thanks for any help.

Cheers,
Kamarul

 
 
 

1. seperate login schemes for seperate users

   I'm trying to set up my linux with a login which will
go directly to X, another which will automatically login
and bring up my mail, another...you get the idea.
   Does anyone know how I can set each login to run a
seperate shell script?      thanx

                                        Alistair

--
|--------------------------------------|

|ashes to ashes,                       |
|  dust to dust...                     |
|if you don't take it out and use it,  |
|it's going to rust.                   |
|                       General Katana |
|                       Highlander II  |
|--------------------------------------|

2. Big Mother Proxy!!!

3. How to seperate text/numbers?

4. Can PING but can't TELNET

5. Multiple Privileged UE Errors

6. Matrox Mystique ands X.

7. Suse6.4 and X...

8. Upgrading harwrae and Alphabet soup!

9. I want to match on an odd number of characters

10. max number of characters in a group name

11. The directory name is Capital Alphabet ?

12. I need help on major and minor numbers for character file