Exponents


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Exponents
# 1  
Old 12-07-2011
Exponents

Hi!

I have a set of numbers like this

Code:
 1192.0    0.219E+00
 1192.0   -0.446E-02
 1192.0    0.924E-01
 1192.0   -0.306E-01
 1192.0    0.105E-03
 1192.0    0.819E-01

Is there an easy way (with awk maybe?) to make all numbers in the second column have the same exponent.

Thanks!
# 2  
Old 12-07-2011
Try...
Code:
awk '{printf "%+fe-%02d\n", $2*(10^n), n}' n=2 file1

This User Gave Thanks to Ygor For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Grep Exponents

I cannot figure out how to grep for an exponent in a file. Any help is greatly appreciated. (1 Reply)
Discussion started by: onshore
1 Replies

2. Shell Programming and Scripting

Bash squares and exponents

I'm trying to write a simple bash script and I need something like var=2^(5+i) where i is another variable. How would do I this in bash? (1 Reply)
Discussion started by: jeriryan87
1 Replies
Login or Register to Ask a Question