multiply with awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting multiply with awk
# 1  
Old 01-30-2012
multiply with awk

HI help

i have

cc 9+37.50 328611.50 688498.25 42.38

cc 66+62.50 328636.50 688498.42 42.58


i want to make o/p

cc 9+3750 328611.50 688498.25 42.38

cc 66+6250 328636.50 688498.42 42.58


plz help
# 2  
Old 01-30-2012
Code:
# awk '{sub("\\.","",$2)}1' infile

# 3  
Old 01-30-2012
Based on the input given ..
Code:
$ sed 's,\.,,1' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Problem with getting awk to multiply a field by a value set based on condition of another field

Hi, So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies

2. UNIX for Dummies Questions & Answers

Multiply value by row

Hi I would like to know how can I multiply the value of column three to columns 4-end of file example of input file: rs1000012 AK8 2 0.05 0.05 1 0 0 rs10000154 PAQR3 0.01 2 1 2 2 1 Desired output file: rs1000012 AK8 ... (1 Reply)
Discussion started by: fadista
1 Replies

3. Shell Programming and Scripting

How to search, replace and multiply variable within awk?

I have a file that reports the size of disks GB's or TB's - I need the file to report everything in MB's. Here is an extract of the file - the last column is the disk size. 19BC 2363 20G 1AA3 2363 2.93T 1A94 2363 750G Whenever I come across a G I want to delete the G and multiply by... (2 Replies)
Discussion started by: kieranfoley
2 Replies

4. Shell Programming and Scripting

Multiply a row of numbers

the following is used to add numbers: echo 7 47 47 44 4 3 3 3 3 3 | awk '{ for(i=1; i<=NF;i++) j+=$i; print j; j=0 }' how do i multiply OR subtract a row of numbers using the above tactic? (8 Replies)
Discussion started by: SkySmart
8 Replies

5. Shell Programming and Scripting

awk multiply values contained in 2 different files

Hi Everyone ! I have two files with the same configuration and I want to multiply corresponding values and write the result in a file. Let say 2 header lines and then lines of values (with not constant number of columns): more file1.txt --> BLABLABLA BLABLABLA 1 2 3 4 1 2 3 1 2 1... (7 Replies)
Discussion started by: Youm
7 Replies

6. Shell Programming and Scripting

awk multiply fields within lines, then total

Here is my scenario, I have two columns. I need to add the first columns (the easy part). The second column is a percent that I need to subtract by 100 then multiply against the first column for each line, then sum the output for a total Here is the input: 942330863 96 942172150 95... (4 Replies)
Discussion started by: mminaz
4 Replies

7. Shell Programming and Scripting

Multiply whole column with a value

Hi, I need to multiply 3rd column (comma seperated) of entire file by a value say 2.2. Suppose the file is: C,Gas $ YTD(TRI),15512.36,01/01/2010 New file should be (3rd column value multiplied by 2.2): C,Gas $ YTD(TRI),34127.192,01/01/2010 (5 Replies)
Discussion started by: yale_work
5 Replies

8. Shell Programming and Scripting

All I want to do is Multiply...

All I want to do is find 5!. read num num={1..5} while do f= done echo f Error Msg. line 5: ${1..5} bad substitution line 6: integer expression expected Line 5 is the num=... Line 6 is the "while" statement I am new at this, and I am really, really trying. Please... (14 Replies)
Discussion started by: Ccccc
14 Replies

9. Shell Programming and Scripting

Multiply variables

I have no idea about programming, just know some simple html :confused:and I need to get to somebody that can help me with creating the application (?) that will multiply 2 varibales and given price (height x lenght) x $$$. PLEASE HELP!:confused: edit by bakunin: Anita, as much as we... (2 Replies)
Discussion started by: Anita Flejter
2 Replies

10. Shell Programming and Scripting

multiply variable

I need to multiply the value of a variable and then store it in another variable. I have EXPHOURINSEC=$(($EXPDATEHOUR * 3600)) but i get an error saying the * is unexpected. Im using ksh (4 Replies)
Discussion started by: fwabbly
4 Replies
Login or Register to Ask a Question