Sponsored Content
Top Forums Shell Programming and Scripting How to add the number of events grouped by field Post 302439017 by Franklin52 on Wednesday 21st of July 2010 11:28:33 AM
Old 07-21-2010
Try this:
Code:
awk '{print $0 FS a[$1]++ +1}' file

This User Gave Thanks to Franklin52 For This Post:
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

add increment field when first field changes

Hi I have a file that looks like the following: Name1 aaa bbbb Name1 ffd hhghg Name1 dffg ghhhh Name2 rtrt dfff Name2 rrtfr tgtt Name2 dsddf gfggf Name2 ffffg gfgf NAme3 fdff ghhgh Is it possible to format it so that a number... (2 Replies)
Discussion started by: azekry
2 Replies

2. UNIX for Dummies Questions & Answers

Number Grouped Rows in File

I have a file containing 750,000 records and have managed to sort them by related columns and now i'd like to add an ID number to the front of each line of the records that are grouped together. Which probably makes no sense so i have provided some example data and desired result. Given data.txt... (2 Replies)
Discussion started by: RacerX
2 Replies

3. Shell Programming and Scripting

Sorting on two fields time field and number field

Hi, I have a file that has data in it that says 00:01:48.233 1212 00:01:56.233 345 00:09:01.221 5678 00:12:23.321 93444 The file has more line than this but i just wanted to put in a snippet to ask how I would get the highest number with time stamp into another file. So from the above... (2 Replies)
Discussion started by: pat4519
2 Replies

4. Shell Programming and Scripting

Count number of occurences of a character in a field defined by the character in another field

Hello, I have a text file with n lines in the following format (9 column fields): Example: contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Discussion started by: s052866
3 Replies

5. Shell Programming and Scripting

awk field equal something, then add something to the field

Hi Everyone, a.txt a b c 1 e e e e e a b c 2 e e e e e the output is a b c 1 e e e e e a 00b c 2 e e e e e when 4th field = '2', then add '00' in the front of 2nd field value. Thanks (9 Replies)
Discussion started by: jimmy_y
9 Replies

6. Shell Programming and Scripting

Adding total of first field for each number in the second field

Dears, I need a script or command which can find the unique number from the second filed and against that number it adds the total of first field . 17215630 , 0 907043 ,1 201050 ,10 394149 ,4 1964 ,9 17215630, 0 907043 ,1 201050, 10 394149 ,4 1964 ,9 1234234, 55 23 ,100 33 ,67 ... (2 Replies)
Discussion started by: shary
2 Replies

7. Shell Programming and Scripting

awk to find number in a field then print the line and the number

Hi I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field. The source file is pipe delimited and looks something like 1|net|ABC Letr1|1530||| 1|net|EXP_1040 ABC|1121||| 1|net|EXP_TG1224|1122||| 1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies
SMFSH(1)																  SMFSH(1)

NAME
smfsh - SMF shell SYNOPSIS
smfsh [ -V ] [ file ] OPTIONS
-V Print libsmf version and exit. file Load the file. DESCRIPTION
smfsh, an "SMF shell", is an interactive, command-driven frontend to libsmf, useful for modifying MIDI files by hand. It started its life as a debugging aid for libsmf. There are four groups of commands: SMF level, track level, event level, and others. SMF LEVEL COMMANDS
SMF level commands display or change properties of smf (i.e. the MIDI file) as a whole. save file Save a file. If the file name is not given, the last file name is used. Note that this will not ask for confirmation. load file Load a file. If the file name is not given, the last file name is used. Instead of using "load", you can pass the file name on the command line. ppqn new-ppqn Show (if used without parameter) or change PPQN (Pulses Per Quarter Note, aka Division). format new-format Show (if used without parameter) or change format. tempo Show tempo map. Tempo map is computed automatically from the SMF contents - to modify a tempo, just add a Tempo Change event using "add" command. length Show total length of the song. Just like the tempo map, file length is computed from the SMF contents. TRACK LEVEL COMMANDS
Track level commands display or change properties of tracks. SMF may contain one or more tracks. tracks Show the list of tracks in the SMF. track track-number Show details of a track (if called without parameter), or select track with a given number - for example in order to display ("events") the events it contains. trackadd Create new track. trackrm track-number Remove the track. If the track number is not given, this will remove the track currently selected. EVENT LEVEL COMMANDS
Event level commands display or change properties of events. Events are grouped into tracks. Track may contain any number of events, including zero. events Show the list of events in the current track. event event-number Show information about a current event (if used without parameter) or select the event. add time-in-seconds midi-message-as-hex Add new event to the currently selected track. rm event-number Remove the event. If the event number is not given, this will remove the event currently selected. OTHER COMMANDS
There are three commands in the "other" category - "help", "version", and "exit". Their meaning should be self expanatory. smfsh 1.3 21 March 2010 SMFSH(1)
All times are GMT -4. The time now is 11:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy