Sponsored Content
Top Forums Shell Programming and Scripting Math operations with file columns values. Post 302550983 by itkamaraj on Monday 29th of August 2011 03:55:21 AM
Old 08-29-2011
Code:
 
$ nawk -F, '{print $1","$2/1048576"MB,"$3/1048576"MB"}' test                                                                                      
1,1MB,1MB
2,2MB,2MB
3,2MB,2MB

$ cat test
1,1048576,1048576
2,2097152,2097152
3,2097152,2097152

---------- Post updated at 01:25 PM ---------- Previous update was at 01:24 PM ----------

if you want to test handle some floating points in output, then try printf
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Operations on columns of 2 files

Hi I have 2 file with many lines and colums and i want to do some operation for each value in the 2 files : Matrix1 : a11 a12 a13 a14 ... a21 a22 a23 a42 ... a31 a32 a33 a32 ... ... Matrix2 : b11 b12 b13 b14 ... b21 b22 b23 b42 ... b31 b32 b33 b32 ... ... I want to have the... (8 Replies)
Discussion started by: rauchy
8 Replies

2. Shell Programming and Scripting

sending field values in columns to output file

Hi, I am trying to send output from a shell scrip to a txt file in a colum format. I have all I can and I dont seem to understand why the results from one one particular file keeps going to the next line. How can I force all to be in one line Please see code and output below The is... (0 Replies)
Discussion started by: asemota
0 Replies

3. UNIX for Dummies Questions & Answers

combine the values from the first two columns within a file

Hello everybody, I have a text file containing 10,000 rows and 5000 columns. The values are separated by a tab. Ex. file_ex.ped 1 mike 0 0 2 1 A A G G C T A G 1 jack 0 0 2 2 T A G T C A A C 1 Mary 0 0 1 2 A T G C A T G C ... I would like a out put file 1 mike 0 0 2 1 AA GG CT AG 1... (7 Replies)
Discussion started by: Unilearn
7 Replies

4. Shell Programming and Scripting

Copy values from columns matching in those in second file.

Hi All, I have two sets of files. Set 1: 100 text files with extension .txt with names like 1.txt, 2.txt, 3.txt until 100.txt Set 2: One big file with extension .dat The text files have some records in columns like this: 0.7316431 82628 0.7248189 82577 0.7248182 81369 0.7222999... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. UNIX for Dummies Questions & Answers

Subtracting values from 2 columns in a file

Hello, I have a file with 5 columns that looks like this: A1BG chr19 + 58863335 58866549 A1BG chr19 - 58858171 58864865 A2LD1 chr13 - 101182417 101186056 A2LD1 chr13 - 101182417 101241046 A2M chr12 - 9220303 9268558 A2ML1 ... (5 Replies)
Discussion started by: wolf_blue
5 Replies

6. UNIX for Dummies Questions & Answers

Removing columns from a text file that do not have any values in second and third columns

I have a text file that has three columns. But at the end of the text file, there are trailing lines that have missing second and third columns: 4 0.04972604 KLHL28 4 0.0497332 CSTB 4 0.04979822 AIF1 4 0.04983331 DECR2 4 0.04990344 KATNB1 4 4 4 4 How can I remove the trailing... (3 Replies)
Discussion started by: evelibertine
3 Replies

7. Shell Programming and Scripting

Help needed with multiplying two values of two columns in a file

Hi, I am trying to multiply column#1 with column#2 using a shell script. How can I make a for-loop script using 1st column as "i" and the second column as "j" from the following file? Please feel free to share any alternative ways to multiplying column#1 with column#2. .06 5.0000 .49 ... (6 Replies)
Discussion started by: momin
6 Replies

8. Shell Programming and Scripting

Identifying columns and their values based on schema file

I have 3 files, data file,schema file and a threshold file. Data file contains data in which columns are distributed according to schema file. This data file doesn't contain any headers. Three continuous columns in the data file represent single variable in schema file. first column represent... (1 Reply)
Discussion started by: bharathbangalor
1 Replies

9. UNIX for Beginners Questions & Answers

Awk: compare values in two columns of the same file

I'm trying to learn awk, but I've hit a roadblock with this problem. I have a hierarchy stored in a file with 3 columns: id name parentID 4 D 2 2 B 1 3 C 1 1 A 5 I need to check if there are any values in column 3 that are not represented anywhere in column 1. I've tried this: awk '{arr;}... (7 Replies)
Discussion started by: kaktus
7 Replies

10. UNIX for Beginners Questions & Answers

Add values to file in 2 new columns

Columns 4 and 5 are X and Y coordinates, column 6 is the elevation I would like to add 2 new columns at the end of the file with values the distance between first(X)(Y) and last location (X)(Y), based in 2 rows the difference in elevation = ($6-prev6) How to calculate the requested values... (6 Replies)
Discussion started by: jiam912
6 Replies
CONSTANTS(5)							LAM FORTRAN LIBRARY						      CONSTANTS(5)

NAME
CONSTANTS - constants for LAM Fortran programming DESCRIPTION
The following table describes the values appropriate to various constants used in LAM. It also describes the meaning of the constants and lists the cpp(1) header files in which the constants can be found. To use these files, the Fortran source files will need to be passed through cpp(1) before they are given to the Fortran compiler. Some compiler drivers will run cpp(1) if the source file suffix is .F. In lieu of cpp(1), the constants can be copied to parameter statements in the Fortran source files. CONSTANT VALUE DESCRIPTION FILE Network Constants: LOCAL -2147483647 local node NET.h MAXNMSGLEN 8192 maximum length of one message packet NET.h NHDSIZE 8 maximum size in words of ndata NET.h argument NOTNODEID -2147483648 error occurred in IGNDID(2) NET.h NOTNODETYPE -2147483648 error occurred in IGRTP(2) NET.h Node Types: NTCAST 2 multicast definition NET.h NTWASTE 4 not fully used/wasted NET.h NTDISK 8 node with attached disk NET.h NTTUBE 16 node with attached video unit NET.h NTJONES 32 node is a neighbour NET.h NTBOOT 64 neighbour node to boot NET.h NTALL 127 matches any type NET.h Message Flags: NOBUF 16 turn off buffering NET.h NREEL 1024 multireel NET.h DRAWDATA 65536 ndata representation will not be NET.h changed DINT4DATA 131072 ndata holds 8 32-bit integer NET.h DFLT4DATA 262144 ndata holds 8 single precision reals NET.h DFLT8DATA 524288 ndata holds 4 double precision reals NET.h DRAWMSG 1048576 nmsg representation will not be NET.h changed DINT4MSG 2097152 nmsg holds integers NET.h DFLT4MSG 4194304 nmsg holds single precision reals NET.h DFLT8MSG 8388608 nmsg holds double precision reals NET.h Reserved Cast Identifiers: HOST2ALL -2147483646 multicast from origin to all nodes NET.h HOST2COMP -2147483642 multicast from origin to compute nodes NET.h File Flags: O_RDONLY 0 open for reading only FREQ.h O_WRONLY 1 open for writing only FREQ.h O_RDWR 2 open for reading and writing FREQ.h O_APPEND 8 append on each write FREQ.h O_CREAT 512 create file if it does not exist FREQ.h O_TRUNC 1024 truncate length to 0 FREQ.h O_EXCL 2048 error if create and file exists FREQ.h O_SYNC 8192 update file data and file status FREQ.h before writing O_LOCK 65536 lock file descriptor active FREQ.h O_REUSE 131072 reuse existing file descriptor FREQ.h O_1WAY 4194304 do not acknowledge writes FREQ.h Process Runtime Flags: RTF_WAIT 16 child sends a message to NET.h parent when it exits RTF_TRACE 256 enable process tracing NET.h LAM 7.1.4 July, 2007 CONSTANTS(5)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy