awk adding counts together from column


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers awk adding counts together from column
# 8  
Old 08-28-2013
DON'T use notepad; it will leave DOS style files behind. Use genuine unix editors!
This User Gave Thanks to RudiC For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Des/awk for change format and adding integers in a column of data?

Greetings! I need a quick way to change the format in a table of data Here is an example of the input: 10 72 Value=177 VDB=0.0245 Value4=0,0,171,0 10 274 Value=238 VDB=0.0433 Value4=29,0,205,0 10 312 Value=222 VDB=0.0384 Value4=8,0,190,19 10 540 Value=405 VDB=0.0391 Value4=13,30,153,195... (3 Replies)
Discussion started by: Twinklefingers
3 Replies

2. Shell Programming and Scripting

Adding a specified value to a specified column - awk?

Hi everyone! I sometimes need to do some simple arithmetics, like adding a number to a certain column of a file. So I wrote a small function in the .bashrc file, which looks like this shifter() { COL=$1 VAL=$2 FILE=$3 cp $FILE $FILE.shifted awk 'NF==4 {$(( $COL )) = $(( $COL ))... (6 Replies)
Discussion started by: radudownload
6 Replies

3. Shell Programming and Scripting

Filtering lines for column elements based on corresponding counts in another column

Hi, I have a file like this ACC 2 2 21 aaa AC 443 3 22 aaa GCT 76 1 33 xxx TCG 34 2 33 aaa ACGT 33 1 22 ggg TTC 99 3 44 wee CCA 33 2 33 ggg AAC 1 3 55 ddd TTG 10 1 22 ddd TTGC 98 3 22 ddd GCT 23 1 21 sds GTC 23 4 32 sds ACGT 32 2 33 vvv CGT 11 2 33 eee CCC 87 2 44... (1 Reply)
Discussion started by: polsum
1 Replies

4. Linux

Adding a prefix to a column using awk/sed commands

Hello, I am a newbie to linux and struggling to find a better way to append a column in a text file. Here is the file i want to modify: It has 8 columns (and thousands of rows). I want to append the first column by adding "chr" infront of the numbers. Some rows have a string in the first... (4 Replies)
Discussion started by: bjorngill
4 Replies

5. Shell Programming and Scripting

Adding column using awk

Hello everyone, I have a file with the following structure: abc xyz 111 222 agf hjhf 787 799 tht yah 878 898 ... ... ... ... ... ... ... ... ... ... ... ... I want to add a column (with a fixed value of 1000) at the end such that it becomes: abc xyz 111 222 1000 agf hjhf 787... (5 Replies)
Discussion started by: ad23
5 Replies

6. UNIX for Dummies Questions & Answers

how to get distinct counts in a column of a file

If i have a file sample.txt with more than 10 columns and 11th column as following data. would it be possible to get the distinct counts of values in single shot,Thank you. Y Y N N N P P o Expected Result: Value count Y 2 N 3 P 2 (2 Replies)
Discussion started by: Ariean
2 Replies

7. UNIX for Dummies Questions & Answers

Adding a column with the row number using awk

Is there anyway to use awk to add a first column to my data that automatically goes from 1 to n , where n is the numbers of my rows?:confused: (4 Replies)
Discussion started by: cosmologist
4 Replies

8. Shell Programming and Scripting

sed/awk-adding numeric to a column

I have a txt file as follows Code: Oct 1 file1 4144 Oct 1 file23 5170 Oct 2 file5 3434 Oct 21 file56 2343 I need to add a new column by marking the right log file from current directory. For example populate like this. Please not in the second columt for "1" it has... (2 Replies)
Discussion started by: gubbu
2 Replies

9. Shell Programming and Scripting

awk-adding a column to a file

Hello Friends, i used awk to sum up total size of files under a directory (with the help of examples, threads here). ls -l | awk '/^-/ {total += $5} END {printf "%15.0f\n",total}' >> total.txt After each execution of the script total result is appended into a text file: 7010 7794 8890 ... (7 Replies)
Discussion started by: EAGL€
7 Replies

10. Shell Programming and Scripting

problem while adding column values in awk

Hi, I have a file "input.txt" with the following content : 5312,0,,,1,8,141.2,20090727 3714,0,,,1,8,285.87,20090727 5426,0,,,1,8,3.9,20090727 3871,0,,,1,8,30.4,20090727 9071,0,,,1,8,146.2,20090727 5141,0,,,1,8,2.8,20090727 0460,0,,,1,8,-0.1,20090727 7918,0,,,1,8,-0.1,20090727... (3 Replies)
Discussion started by: valokv
3 Replies
Login or Register to Ask a Question
cord2(1)						      General Commands Manual							  cord2(1)

Name
       cord2 - rearranges basic blocks in an executable file to facilitate better cache mapping.

Syntax
       cord2 [-v] [-o outfile] [-c cachewords] [-d] [-b bridge_limit] [-n] [-A addersfile] [[-C countsfile] ...] obj

Description
       The  cord2  command extracts basic blocks from a program and deposits them in a new area in the text, making jumps to and from that area as
       necessary.  By separating the basic blocks, you can reduce instruction cache miss rates.  The cord2 command takes the  output  of  a  pixie
       profiling run as input (see

       The executable object file has the suffix obj.  The cord2 command only requires one addersfile; it creates the filename by appending .Bbad-
       drs to the obj filename if none is specified with -A. Multiple counts files can be specified from many runs with multiple -C arguments.	If
       none are specified, cord2 creates the counts filename by appending .Counts to the obj name.

       Multiple  counts  files are added together into an internal counts array represented with C double-type elements. The counts array elements
       contain the density of a block or cycles/byte.  If you specify -n, then the counts are normalized  so  that  each  counts  array  entry	is
       cycles/totalcycles.   When one counts file is specified, the default is to favor small blocks; -n negates that.	When many counts files are
       specified, -n also negates favoring one counts file. This is because its totalcycles may exceed the totalcycles of another counts file.

       The cord2 command determines which basic blocks to insert by sorting the counts array and collecting the blocks	with  the  highest  counts
       that can fit into the new area.	The cord2 command may skip over huge blocks that do not fit at the end of the new area.

       Once  the  blocks are determined, they are inserted into the new area, and their original location is modified to jump to the new area.	At
       the end of each block in the new area, a jump is added  back  to  the  original	block's  subsequent  or  fall-through  location,  and  the
       branch/jump  target  (if necessary).  Both entering and exiting the new area is optimized to take advantage of other blocks in the new area
       and jump delay slots.

       Often, there may be one or more fall-through blocks of a block in the new area which are small, hardly ever used, and not in the new  area.
       If  the	block  following  these  fall-through blocks is in the new area, the fall-through blocks are called bridge blocks.  It may be more
       costly to generate jumps to and from bridge blocks rather than to simply copy them.

       The cord2 command allows you to specify that bridge blocks be added to the new area if they total less than the	bridge_limit  instructions
       between	two  new-area blocks. You can specify the bridge_limit with -b; the default is zero.  Bridge blocks can bump blocks out of the new
       area that might normally fit into it.

       Because the cord2 command works from profile output, the resulting binary is data dependent. In other words, it may perform  well  only	on
       the  same input data that generated the profile information, and may perform worse than the original binary on other data.  Furthermore, if
       the hot areas in the cache do not fit well into one cachepage, performance can degrade.

Options
       The cord2 command also accepts these options:

       -d   Fill the delay slots with nops only when adding jumps to and from the new area.

       -v   Print verbose information. This includes statistics about the cord2 process.

       -v -v
	    Print all of the -v information, but include detailed disassemblies of the code moved, changed, and generated by cord2.

       -c cachewords
	    Specify the number of words in the cache of the machine on which you want to execute.  This is actually the size of the new area.  The
	    cachesize  may be a misnomer, as you can specify a size other than your machine's cache size; however, it is probably the correct num-
	    ber.

       -o outputfile
	    Specify the output file.  If it is not specified, the default is a.out.cord2.

Restrictions
       The cord2 command adds the new area to the end of text so any program using the etext symbol may not work.  See

See Also
       pixie(1), cord(1)

								       RISC								  cord2(1)