Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Solved] Find position of character with awk Post 302844721 by Indra2011 on Tuesday 20th of August 2013 12:30:01 AM
Old 08-20-2013
Thanks every one of you for the help!!!!

Moderator's Comments:
Mod Comment edit by bakunin: changed thread title accordingly

Last edited by bakunin; 08-20-2013 at 07:46 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find if a position is between a given start and end position

Hi, I am a newbie in unix programming so maybe this is a simple question. I would like to know how can I make a script that outputs only the values that are not between any given start and end positions Example file1: 2 30 40 80 82 100 file2: ID1 1 ID2 35 ID3 80 ID4 81 ID6... (9 Replies)
Discussion started by: fadista
9 Replies

2. UNIX for Dummies Questions & Answers

Req 1-liner for Awk, et al to find str position

Hi, I'm trying to find the position of a series of numbers within a large text file. The numbers are separated by spaces. This works fine: type Huge_File.txt | gawk "{print index($0,"255")}" But this does not: type Huge_File.txt | gawk "{print index($0,"188 028 239 160 016 190 137... (4 Replies)
Discussion started by: Lemming42
4 Replies

3. Shell Programming and Scripting

Delete character in determinate position with sed/awk

Hello. I'm trying to delete one character in determinate position. Example: qwEtsdf123Ecv34 <delete character in positión 3> Result: qwtsdf123Ecv34 Plase, help me. Thanks (4 Replies)
Discussion started by: maria_florencia
4 Replies

4. Shell Programming and Scripting

How to find character position in file?

how to find character positionin file? i.e string = "123X568" i want to find the position of character "X". Thanks (6 Replies)
Discussion started by: LiorAmitai
6 Replies

5. Shell Programming and Scripting

Find position of character in multiple strings in a file

Greetings. I have a file with information like this: AMNDHRKEOEU?AMNDHRKEOEU?AMNDHRKEOEU?AMNDHRKEOEU? AMNDHRKEEU?AMNDHREOEU? AMNDHREU?AHRKEOEU?AMNDHRKEU?AMNDKEOEU? What I need to extract is the position, in every line, of every occurrence of '?' A desired output would be something... (6 Replies)
Discussion started by: Twinklefingers
6 Replies

6. Shell Programming and Scripting

Find character and Replace character for given position

Hi, i want find the character '-' in a file from position 284-298, if it occurs i need to replace it with 'O ' for the position in the file. How to do that using SED command. thanks in advance, Sara (9 Replies)
Discussion started by: Sara183
9 Replies

7. Shell Programming and Scripting

[Solved] Find and replace till nth occurence of a special character

Hi, I have a requirement to search for a pattern in each line in a file and remove the in between words till the 3rd occurrence of double quote ("). Ex: CREATE TABLE "SCHEMANAME"."AMS_LTV_STATUS" (Note: "SCHEMANAME" may changes for different schemas. Its not a fixed value) I need to... (2 Replies)
Discussion started by: satyaatcgi
2 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Awk: count occurrence of each character for every field

Hi, let's say an input looks like: A|C|C|D A|C|I|E A|B|I|C A|T|I|B as the title of the thread explains, I am trying to get something like: 1|A=4 2|C=2|B=1|T=1 3|I=3|C=1 4|D=1|E=1|C=1|B=1 i.e. a count of every character in each field (first column of output) independently, sorted... (4 Replies)
Discussion started by: beca123456
4 Replies

9. Shell Programming and Scripting

To find nth position of character in string

Hi guyz i want to know nth position of character in string. For ex. var="UK,TK,HK,IND,AUS" now if we see 1st occurance of , is at 3 position, 2nd at 6,..4th at 13 position. 1st position we can find through INDEX, but what about 2nd,3rd and 4th or may be upto nth position. ? In oracle we had... (2 Replies)
Discussion started by: Jonty Immortal
2 Replies

10. Shell Programming and Scripting

awk sed to repeat every character on same position from the upper line replacing whitespace

Hello is it possible with awk or sed to replace any white space with the previous line characters in the same position? I am asking this because the file I have doesn't always follow a pattern. For example the file I have is the result of a command to obtain windows ACLs: icacls C:\ /t... (5 Replies)
Discussion started by: nakaedu
5 Replies
Statistics::Basic::Mode(3pm)				User Contributed Perl Documentation			      Statistics::Basic::Mode(3pm)

NAME
Statistics::Basic::Mode - find the mode of a list SYNOPSIS
Invoke it this way: my $mode = mode(1,2,3,3); Or this way: my $v1 = vector(1,2,3,3); my $mod = mode($v1); And then either query the values or print them like so: print "The mod of $v1: $mod "; my $mq = $mod->query; my $m0 = 0+$mod; # this will croak occasionally, see below The mode of an array is not necessarily a scalar. The mode of this vector is a vector: my $mod = mode(1,2,3); my $v2 = $mod->query; print "hrm, there's three elements in this mode: $mod " if $mod->is_multimodal; Create a 20 point "moving" mode like so: use Statistics::Basic qw(:all nofill); my $sth = $dbh->prepare("select col1 from data where something"); my $len = 20; my $mod = mode()->set_size($len); $sth->execute or die $dbh->errstr; $sth->bind_columns( my $val ) or die $dbh->errstr; while( $sth->fetch ) { $mod->insert( $val ); if( defined( my $m = $mod->query ) ) { print "Mode: $m "; } print "Mode: $mod " if $mod->query_filled; } METHODS
new() The constructor takes a list of values, a single array ref, or a single Statistics::Basic::Vector as arguments. It returns a Statistics::Basic::Mode object. Note: normally you'd use the mean() constructor, rather than building these by hand using "new()". is_multimodal() Statistics::Basic::Mode objects sometimes return Statistics::Basic::Vector objects instead of numbers. When "is_multimodal()" is true, the mode is a vector, not a scalar. _OVB::import() This module also inherits all the overloads and methods from Statistics::Basic::_OneVectorBase. OVERLOADS
This object is overloaded. It tries to return an appropriate string for the calculation or the value of the computation in numeric context. In boolean context, this object is always true (even when empty). If evaluated as a string, Statistics::Basic::Mode will try to format a number (like any other Statistics::Basic object), but if the object "is_multimodal()", it will instead return a Statistics::Basic::Vector for stringification. $x = mode(1,2,3); $y = mode(1,2,2); print "$x, $y "; # prints: [1, 2, 3], 2 If evaluated as a number, a Statistics::Basic::Mode will raise an error when the object "is_multimodal()". AUTHOR
Paul Miller "<jettero@cpan.org>" COPYRIGHT
Copyright 2012 Paul Miller -- Licensed under the LGPL SEE ALSO
perl(1), Statistics::Basic, Statistics::Basic::_OneVectorBase, Statistics::Basic::Vector perl v5.14.2 2012-01-23 Statistics::Basic::Mode(3pm)
All times are GMT -4. The time now is 04:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy