1829467 Members
1527 Online
109991 Solutions
New Discussion

a smalll query

 
SOLVED
Go to solution
zxcv
Super Advisor

a smalll query

Hi guys,

 

I have a file say with contents ;

 

123

345

567

789

i need  a o/p like the following ;

 

2.3

4.5

6.7

8.9

 

4 REPLIES 4
Dennis Handly
Acclaimed Contributor

Re: a small query

It appears you are taking the second and third columns:

sed -e 's/^.\(.\)\(.\)/\1.\2/' file

zxcv
Super Advisor

Re: a small query

Hi Dennis ,

u were spot on...but i misundeerstoodd the exact reqmnt...the actual reqmnt given below;

 


 

last 2 numbers should be divisible by a fixed number say 500 and it shuld display me the o/p.... 

Dennis Handly
Acclaimed Contributor
Solution

Re: a small query

>last 2 numbers should be divisible by a fixed number say 500

 

awk  '
{
num = substr($0, 2, 2)  # skip first column
print num / 500
} ' file

zxcv
Super Advisor

Re: a small query

Thanks Dennis very much :)