Sponsored Content
Full Discussion: Recalculating frequencies
Top Forums Shell Programming and Scripting Recalculating frequencies Post 302433437 by bartus11 on Tuesday 29th of June 2010 04:54:20 PM
Old 06-29-2010
Try that:
Code:
awk -vRS=">" 'length($0)>0{a[$4]+=$3;b[$4]=$1}END{for (i in a) printf ">"b[i]" Freq "a[i]"\n"i"\n"}' file

This User Gave Thanks to bartus11 For This Post:
 

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending lines with word frequencies, ordering and indexing a column

Dear All, I have the following input data: w1 20 g1 w1 10 g1 w2 12 g1 w2 23 g1 w3 10 g1 w3 17 g1 w3 12.5 g1 w3 21 g1 w4 11 g1 w4 13.2 g1 w4 23 g1 w4 18 g1 First I seek to find the word frequencies in col1 and sort col2 in ascending order for each change in a col1 word. Second,... (5 Replies)
Discussion started by: Ghetz
5 Replies

2. Shell Programming and Scripting

Merging Frequencies in a File

hello, I have a file which has the following structure: word <TAB> frequency The same word can have multiple frequencies: John <TAB> 60 John <TAB> 20 John <TAB> 30 Mary <TAB> 1000 Mary <TAB> 800 Mary <TAB> 20 What I need is a script which could merge all these frequencies into one single... (10 Replies)
Discussion started by: gimley
10 Replies

3. Shell Programming and Scripting

Removal of extra spaces in *.log files to allow extraction of frequencies

Our university has upgraded its version of a computational chemistry program that our group uses quite regularly. In the past we have been able to extract frequency spectra from log files that are generated. Since the upgrade, the viewing program errors out. I've been able to trace down the changes... (16 Replies)
Discussion started by: wsuchem
16 Replies

4. UNIX for Dummies Questions & Answers

Gaps and frequencies

I have this infile: >GHL8OVD01BNNCA Freq 10 TAGATGTGCCCGTGGGTTTCCCGTCAACACCGGATAGT-GCAGCA-TA >GHL8OVD01CMQVT Freq 1 TTGATGTCGTGGGTTTCCCGTCAACACCGGCAAATAGT-GCAGCA-TA >GHL8OVD01CMQVT Freq 1 TTGATGTGCCAGTTTCCCGTCTAGCAGCACTACCAGGACCTTCGC-TA >GHL8OVD01CMQVW Freq 1... (1 Reply)
Discussion started by: Xterra
1 Replies
EVIM(1) 						      General Commands Manual							   EVIM(1)

NAME
evim - easy Vim, edit a file with Vim and setup for modeless editing SYNOPSIS
evim [options] [file ..] eview DESCRIPTION
eVim starts Vim and sets options to make it behave like a modeless editor. This is still Vim but used as a point-and-click editor. This feels a lot like using Notepad on MS-Windows. eVim will always run in the GUI, to enable the use of menus and toolbar. Only to be used for people who really can't work with Vim in the normal way. Editing will be much less efficient. eview is the same, but starts in read-only mode. It works just like evim -R. See vim(1) for details about Vim, options, etc. The 'insertmode' option is set to be able to type text directly. Mappings are setup to make Copy and Paste work with the MS-Windows keys. CTRL-X cuts text, CTRL-C copies text and CTRL-V pastes text. Use CTRL-Q to obtain the original meaning of CTRL-V. OPTIONS
See vim(1). FILES
/usr/share/vim/vim62/evim.vim The script loaded to initialize eVim. AKA
Also Known As "Vim for gumbies". When using evim you are expected to take a handkerchief, make a knot in each corner and wear it on your head. SEE ALSO
vim(1) AUTHOR
Most of Vim was made by Bram Moolenaar, with a lot of help from others. See the Help/Credits menu. 2002 February 16 EVIM(1)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy