Help ! Absolute beginner ! 
Author Message
 Help ! Absolute beginner !

Hello,

please can someone help me ?

I have a File

10
5
7
4
2
8
9

I want to extract all numbers >= 5 and  <=8 and write this in another
File

Please help a am a newbie



Wed, 05 Feb 2003 08:40:16 GMT  
 Help ! Absolute beginner !


Quote:
> Hello,

> please can someone help me ?

> I have a File

> 10
> 5
> 7
> 4
> 2
> 8
> 9

> I want to extract all numbers >= 5 and  <=8 and write this in another
> File

> Please help a am a newbie

------newbie.awk---------
($1 > = 5) && ($1 <= 8)    {
    print($1);
Quote:
}

-------------------------

if your numbers are in a file nums, ue
    awk -f newbie.awk nums > yourfile

B



Wed, 05 Feb 2003 14:53:15 GMT  
 Help ! Absolute beginner !

Quote:

> Hello,

> please can someone help me ?

> I have a File

> 10
> 5
> 7
> 4
> 2
> 8
> 9

> I want to extract all numbers >= 5 and  <=8 and write this in another
> File

> Please help a am a newbie

gawk '$1>=5 && $1<=8' file.dat

The print statement is implied if no other action
is specified.

Tristan.



Wed, 05 Feb 2003 03:00:00 GMT  
 Help ! Absolute beginner !


Quote:
> Hello,

> please can someone help me ?

> I have a File

> 10
> 5
> 7
> 4
> 2
> 8
> 9

> I want to extract all numbers >= 5 and  <=8 and write this in another
> File

> Please help a am a newbie

Want easiest way?
So write this to the script called like "script.awk" (let's say your input
file would be "file_in", and aoutput file - "file_out":

$1~/[5678]/

And execute it like this (suppose your using UNIX version of AWK):
nawk -f scirpt file_in > file_out
It should work, but only with file build exactly like your example.
Have fun

TomaySOFT



Wed, 05 Feb 2003 03:00:00 GMT  
 Help ! Absolute beginner !

Quote:

> Hello,

> please can someone help me ?

> I have a File

> 10
> 5
> 7
> 4
> 2
> 8
> 9

> I want to extract all numbers >= 5 and  <=8 and write this in another
> File

> Please help a am a newbie

Where "junk" is:

10
5
7
4
2
8
9

Then awk '$1>=5 && $1<=8' junk
yields:

5
7
8

--
Cheers,
Ted J. Loeffelholz
Senior Design Engineer
Caterpillar Inc



Fri, 07 Feb 2003 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. help! absolute beginner

2. Absolute Beginner needs help

3. Help: Absolute Beginner Needs to Fix simple Program

4. Absolute beginner needs a little help

5. Please help absolute Beginner!... Easy Q I think

6. Smalltalk Tutorial for an Absolute Beginner

7. Absolute beginner !

8. An absolute beginner's question...

9. absolute beginner

10. absolute beginners question about API documentation

11. Absolute beginner

12. absolute beginner: where does $tcl_platform come from?

 

 
Powered by phpBB® Forum Software