Help me to find a greater than or smaller than values

Hi,

i need to find one of the value from my file is in between two numbers, that is the value is greater than 34 and smaller than 50,

Ex: File.txt

col1	col2	col3	col4
1	Name1	93	w
2	Name2	94	a
3	Name3	32	b
4	Name4	45	x
5	Name5	50	y
6	Name6	49	z

here i need to find col3 values are greater than 34 and smaller than 50 then i have to replace it with 29.

outputFile.txt

col1	col2	col3	col4
1	Name1	93	w
2	Name2	94	a
3	Name3	32	b
4	Name4	29	x
5	Name5	50	y
6	Name6	29	z

please help me!

$ awk '(($3 > 34) && ($3 < 50)) {$3=29} 1' OFS='\t' file
col1    col2    col3    col4
1       Name1   93      w
2       Name2   94      a
3       Name3   32      b
4       Name4   29      x
5       Name5   50      y
6       Name6   29      z

Try

$ awk '$3>34 && $3<50{$3=29}1' OFS=\\t file

Resulting

col1   col2    col3   col4
1    Name1    93    w
2    Name2    94    a
3    Name3    32    b
4    Name4    29    x
5    Name5    50    y
6    Name6    29    z

Perl

perl -F"\s" -lane 'if($F[2] gt 34 && $F[2] lt 50) { $F[2]=29;} print "@F";'  filename

[/CODE]

will this work for floating point also?

and if i want to add one more condition like col5 has < 79 then it have 0 values. and i need to print in separate col. like

input file.txt

col1	col2	col3	col4	col5	col6
1	Name1	93	w	46	n/a
2	Name2	94	a	59	n/a
3	Name3	32	b	70	n/a
4	Name4	75	x	20	n/a
5	Name5	50	y	19	n/a
6	Name6	49	z	40	n/a

and outputfile.txt

col1	col2	col3	col4	col5	col6
1	Name1	93	w	46	n/a
2	Name2	94	a	59	n/a
3	Name3	36	b	83	29
4	Name4	40	x	20	0
5	Name5	45	y	19	0
6	Name6	49	z	80	29

Floating point should be fine.

In your new example quite a lot of the values have changed, not just column 5?

Like this ?

awk '$3>34 && $3<50 { $3=29;if ($5<79) $6=0}1' OFS=\\t

Please modify the conditions as per your need to get desired output.

Yes, why becos in future any conditions needs to added means it will use.