Sponsored Content
Top Forums Shell Programming and Scripting Counting characters at each position Post 302768315 by amits22 on Friday 8th of February 2013 10:24:02 AM
Old 02-08-2013
Thank you so much RudiC, didn't know about this trick
Code:
{freq[$i,i]++; Base[$i]}

I understand its taking your time, could I request you to explain above part a bit.

Best,

Amit
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

counting characters

Dears, I would like to count the number of "(" and ")" that occur in a file. (syntax checking script). I tried to use "grep -c" and this works fine as long as there is only one character (for which I do a search) on a line. Has anyone an idea how I can count the number of specific characters... (6 Replies)
Discussion started by: plelie2
6 Replies

2. Shell Programming and Scripting

Counting characters between comma's

I have a comma delimited file that roughly has 300 fields. Not all fields are populated. This file is fed into another system, what I need to do is count the amount of characters in each field and give me an output similiar to this: 1 - 6,2 - 25 The first number is the field and the second... (2 Replies)
Discussion started by: dbrundrett
2 Replies

3. UNIX for Advanced & Expert Users

Counting position of a character

Hi All, I have a file of the format : idsfskjvfdznvdfjvh ierwjfkncmvlkmc xszkmdvnosndzjndf weuhrndzierfncv rndsjnsllshens iernzkfndslkdhf zkinewfinfvlkmvd I wish to count the occurrences of character 'z' in the file. I also need to find out the position of 'z' in various lines. and... (3 Replies)
Discussion started by: rochitsharma
3 Replies

4. UNIX for Dummies Questions & Answers

counting the occurence of particular characters

I want to list the occurence of particular characters in a line. my file looks like this a,b,c,d e,f,g h,y:e,g,y s f;g,s,w and I want to count how many commas are in each line so the file in the end looks like this: a,b,c,d 3 e,f,g 2 h,y:e,g,y s 3 f;g,s,w ... (2 Replies)
Discussion started by: Audra
2 Replies

5. Shell Programming and Scripting

counting characters

Hi All, I need some help in counting the number of letters in a big file with separations. Following is the file I have >AB_1 MLKKPIIIGVTGGSGGGKTSVSRAILDSFPNARIAMIQHDSYYKDQSHMSFEERVKTNYDHPLAFDTDFM IQQLKELLAGRPVDIPIYDYKKHTRSNTTFRQDPQDVIIVEGILVLEDERLRDLMDIKLFVDTDDDIRII... (6 Replies)
Discussion started by: Lucky Ali
6 Replies

6. Shell Programming and Scripting

Counting characters with sed

Input: ghw//yw/hw///??u How can i count the slashes("/") using sed? (13 Replies)
Discussion started by: cola
13 Replies

7. Shell Programming and Scripting

Counting characters within a file

Ok say I wanted to count every Y in a data file. Then set Y as my delimiter so that I can separate my file by taking all the contents that occur BEFORE the first Y and store them in a variable so that I may use this content later on in my program. Then I could do the same thing with the next Y's... (5 Replies)
Discussion started by: puttster
5 Replies

8. Shell Programming and Scripting

Counting the number of characters

Hi all, Can someone help me in getting the following o/p I/p:... (7 Replies)
Discussion started by: Sri3001
7 Replies

9. Shell Programming and Scripting

Counting characters vertically

I do have a big file in the following format >A1 ATGCGG >A2 TCATGC >A3 -TGCTG The number of characters will be same under each subheader and only possible characters are A,T,G,C and - I want to count the number of A's, T's,G's, C's & -'s vertically for all the positions so that I... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

10. Shell Programming and Scripting

Inserting value at a particular position without changing the position of other characters

Hi All, I wanted a sed/awk command to add a value/character on a particular position without disturbing the position of other characters. I have file a.txt OL 10031 Day Black Midi Good Value P01 P07 OL 10031 Day Black Short Good Value P01 P07 I want to get the output as... (2 Replies)
Discussion started by: rahulsk
2 Replies
__PPC_GET_TIMEBASE(3)					     Linux Programmer'sManual					     __PPC_GET_TIMEBASE(3)

NAME
__ppc_get_timebase, __ppc_get_timebase_freq - get the current value of the Time Base Register on Power architecture and its frequency. SYNOPSIS
#include <sys/platform/ppc.h> uint64_t __ppc_get_timebase(void) uint64_t __ppc_get_timebase_freq(void); DESCRIPTION
__ppc_get_timebase() reads the current value of the Time Base Register and returns its value, while __ppc_get_timebase_freq() returns the frequency in which the Time Base Register is updated. The Time Base Register is a 64-bit register provided by Power Architecture processors. It stores a monotonically incremented value that is updated at a system-dependent frequency that may be different from the processor frequency. RETURN VALUE
__ppc_get_timebase() returns a 64-bit unsigned integer that represents the current value of the Time Base Register. __ppc_get_timebase_freq() returns a 64-bit unsigned integer that represents the frequency at which the Time Base Register is updated. VERSIONS
GNU C Library support for __ppc_get_timebase() has been provided since version 2.16 and __ppc_get_timebase_freq() has been available since version 2.17. CONFORMING TO
Both functions are nonstandard GNU extensions. EXAMPLE
The following program will calculate the time, in microseconds, spent between two calls to __ppc_get_timebase(). Program source #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <sys/platform/ppc.h> /* Maximum value of the Time Base Register: 2^60 - 1. Source: POWER ISA. */ #define MAX_TB 0xFFFFFFFFFFFFFFF int main(void) { uint64_t tb1, tb2, diff; uint64_t freq = __ppc_get_timebase_freq(); printf("Time Base frequency = %"PRIu64" Hz ", freq); tb1 = __ppc_get_timebase(); // Do some stuff... tb2 = __ppc_get_timebase(); if (tb2 > tb1) { diff = tb2 - tb1; } else { /* Treat Time Base Register overflow. */ diff = (MAX_TB - tb2) + tb1; } printf("Elapsed time = %1.2f usecs ", (double) diff * 1000000 / freq ); exit(EXIT_SUCCESS); } SEE ALSO
time(2), usleep(3) GNU C Library 2019-03-06 __PPC_GET_TIMEBASE(3)
All times are GMT -4. The time now is 07:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy