Sponsored Content
Top Forums Shell Programming and Scripting Finding contiguous numbers in a list but with a gap number tolerance Post 302728501 by pamu on Thursday 8th of November 2012 02:10:40 AM
Old 11-08-2012
Try something like this

Code:
sort -nk2 file | awk '{if($2 == s){print P;k=1}else if(1==k){print P;k=0;}}  
  {s=$3;P=$0}'

To decide tolerance difference use
Code:
sort -nk2 file | awk -v tol="5" '{if(($2-s)<=tol){print P;k=1}else if(1==k){print P;k=0;}}  
  {s=$3;P=$0}'

This User Gave Thanks to pamu For This Post:
 

10 More Discussions You Might Find Interesting

1. IP Networking

finding port numbers

hither! whatz the command to find which process is using a specific port number? for example, port 8082? (3 Replies)
Discussion started by: darkcastle
3 Replies

2. Shell Programming and Scripting

Finding the sum of two numbers

cat *.out |grep "<some text>" | awk '{print $6}' For ex,This will reutrn me 11111 22222 is it possible to add these two numbers in the above given command itself?I can write this to a file and find the sum. But I prefer to this calculation in the above given line itself. Any... (3 Replies)
Discussion started by: prasperl
3 Replies

3. Shell Programming and Scripting

Need to find the gap in the sequence of numbers

Hi Guys, I have a file with numbers in sequence. The sequence have been broken somewhere.. I need to find out at which number the sequence has been broken... For an example, consider this sequence, it needs to give me output as 4 (as 5 is missing) and 6(as 7 is missing) Thanks for... (3 Replies)
Discussion started by: mac4rfree
3 Replies

4. Shell Programming and Scripting

Finding occurences of numbers

I have two files The first file is in following format 5 937 8 1860 5 1 683 2 1 129 2 2 5 938 8 1122 5 1 20 520 4 1860 1851 1 5 939 8 1122 1124 1 20 521 4 5883 14 6 1860 1852 1 683 4 2 (5 Replies)
Discussion started by: stuggler
5 Replies

5. Shell Programming and Scripting

Finding number of strings in List

I have a list of strings stored in $Lst Example set Lst = "John Fred Kate Paul" I want to return 4 in this case. (1 Reply)
Discussion started by: kristinu
1 Replies

6. Shell Programming and Scripting

the smallest number from 90% of highest numbers from all numbers in file

Hello All, I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns. I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions. If I... (11 Replies)
Discussion started by: Apfik
11 Replies

7. UNIX for Dummies Questions & Answers

Finding numbers in lines with strings and number and doing some manipulation

Hi, I want to write a script that does something like this: I have a file, in which in every line, there is a string of words, and followed by some space, a number. Now, I want to identify the line, which has the largest startFace number (say m=8118), take that number and add it to the... (2 Replies)
Discussion started by: super_commando
2 Replies

8. Shell Programming and Scripting

finding lowest numbers

i want to basically get the lowest numbers from a list ... for example my input file is .... 1 2 3 6 7 8 9 10 11 13 Now i want to create a script or a one liner which i can use like this ... for example ..../getlowest 3 --> this gives me the next 3 lowest numbers which... (6 Replies)
Discussion started by: greycells
6 Replies

9. UNIX for Dummies Questions & Answers

grep specific number from a list of numbers

Hello. I have 9060 files labelled File1 to File9060. They are in numerical order. When I grep a file eg. File90 it will show me all files that contain the pattern "File90", eg File901 or File9001. I can only get specific files for File1000 or higher. How can I resolve this problem? Is there a... (5 Replies)
Discussion started by: godzilla07
5 Replies

10. Shell Programming and Scripting

Number of elements, average value, min & max from a list of numbers using awk

Hi all, I have a list of numbers. I need an awk command to find out the numbers of elements (number of numbers, sort to speak), the average value the min and max value. Reading the list only once, with awk. Any ideas? Thanks! (5 Replies)
Discussion started by: black_fender
5 Replies
IMPUT(1p)						     Internet Message commands							 IMPUT(1p)

NAME
imput - put mail/news message into networks SYNOPSIS
imput [OPTIONS] [MSG] DESCRIPTION
The imput command dispatches mail/news message by way of SMTP/NNTP. This command is provided by IM (Internet Message). With UCB Mail Define "sendmail" environment variable with value "imput". With Mew 1.x Eval (setq mew-prog-imput "imput"). With MH Define sendproc in ~/.mh_profile like "sendproc: imput". With sendmail.el (if you are using VM or ...) Eval (setq sendmail-program "imput"). With mh-e (4 or later) Eval (setq mh-send-prog "imput"). With pine Define "sendmail-path" in ~/.pinerc, for example: sendmail-path=/usr/local/bin/imput -Report -ObeyHeader -IgnoreDot With applications which use sendmail Replace sendmail to this program but if daemon sendmail is required, original sendmail should be renamed to sendmail.bin or something else for starting daemon mode sendmail and for newaliasing. With applications which use inews Header generation by command line option not supported. OPTIONS
--version Output version information and exit. --help Display help message and exit. --debug={on,off} Set all debug options. --debugflag=DEBUG_OPTION Set specific debug options (separated with ','). --verbose={on,off} Print verbose messages when running. --require=STRING User defined perl script to be required. --smtpservers=STRING List of SMTP servers (separated with ','). Each element should be server[/remote_port][%local_port] --emgsmtpsvrs=STRING List of SMTP servers for Emergency Use (i.e. error reporting). --trynextonfatal={on,off} Try next SMTP server evenif permanent failure. --nntpservers=STRING List of NNTP servers (separated with ','). Each element should be server[/remote_port][%local_port] --nntpauthuser=STRING User name for NNTP authentication. --clientname=STRING Name as a SMTP client (used for SMTP HELO). --sshserver=STRING SSH port relay server. --obeymtadomain={on,off} Do not qualify local addresses with default domain. --fromdomain=STRING Default domain name for sender. --todomain=STRING Default domain name for recipients. --msgiduser=STRING A user name for Message-Id generation. --msgiddomain=STRING A domain name for Message-Id generation. --nomsgidfornews=STRING Strip Message-Id when posting to news system. --user=STRING Local part of the sender address. --address=STRING Address used in From: header; equivalent to User@FromDomain --name=STRING Commentary name for sender. --nameincomment={on,off} Show commentary name in () on From: header. --org=STRING Name of organization for news posting. --subj=STRING A string for subject field. --nscmpl={on,off} Use domain-part completion with nameserver. --showrcpts={on,off} Allow to show recipients in header as To: if no To: in original. --metoo={on,off} Request DCC to me. --dcc=STRING Supplemental DCC address. --fcc=STRING Folder name to save FCC. --receipt={on,off} Need a report of successful delivery. --group=STRING Newsgroup names to be posted in. --jpconv={on,off} Convert japanese character encoding from EUC/SJIS to JIS. --defcode=STRING Default classification of japanese character code (EUC/SJIS/8BIT). Default value is "8bit". --jpheader={on,off} Encode japanese JIS characters to MIME style at header. Default value is "on". --hdrqencoding={on,off} Header encoding type: 0 is B; 1 is Q. --nohdrfolding={on,off} Do not fold long header lines. --sortheader=STRING Header sequence for sorting (labels separated with ','). --8to7={on,off} Convert 8bit body to 7bit by base64/quoted-printable encoding. --8bitlabel=STRING Sub-type label for unknown 8bit body on Content-Type:. Default value is "unknown-8bit". --lines=NUM Line numbers for splitting into partial messages. --sleep=NUM Sleep interval for dispatching each splitted messages. Default value is 10. --log=STRING File name to write delivery log. Default value is "putlog". --syslog={on,off} Use SYSLOG feature instead of writing to a file directly. --report={on,off} Report errors via mail. Default value is "on". --msgid={on,off} Generate Message-Id header line. Default value is "on". --pidmsgid={on,off} Generate Message-Id with Process ID. --uidmsgid={on,off} Generate Message-Id with User ID instead of login name. --date={on,off} Generate Date header line. Default value is "on". --newsgmtdate={on,off} Generate date field in GMT for posting news. --uselines={on,off} Generate Lines header line. Default value is "on". --aliasesfile=STRING List of files for mail address aliasing. Default value is "Aliases". --addrbook=STRING List of Addrbook files. --hostaliases=STRING List of files for domain part completion. --fccpartial={on,off} Save FCC with partial format. --dead=STRING Path of file to save unsent message as a deadletter. Default value is "dead.letter". --justqueuing={on,off} Just store message into queue without attempt of delivery. --queuing={on,off} Store message into queue on delivery failure. --processqueue={on,off} Process queued messages. --queuestatus={on,off} Show list of queued messages. --folder=STRING Path of draft folder directory. --mimebcc={on,off} Use MIME (message/rfc822) style BCC. Default value is "on". --trashmark=STRING Prefix character for draft message file renaming. Default value is "#". --preserve={on,off} Preserve draft message as is even if dispatched successfully. --message=STRING Path/name of draft message. --pgpsign={on,off} Generate PGP signature for body-part. --multipartadd=STRING,STRING... Path/name of message to be added as a part of multipart message. --filenameadd={on,off} Add filename field at Content-Disposition header. --smtp={on,off} Perform SMTP style input mode. --annotate={on,off} Annotate on the parent message (MsgDB required). --dist={on,off} Redistribution mode (using Resent-*:). --distmsg=STRING Path of message for redistribution. --obeyheader={on,off} Collect recipients from message header. --ignoredot={on,off} Ignore DOT for message termination. --newscheck={on,off} No news posting if To, Cc header found evenif Newsgroups: exists. --esmtp={on,off} Enforce ESMTP (always begins with EHLO). --newspost={on,off} Enable NNTP. Default value is "on". --addheader=STRING,STRING... Header lines to be added. For compatibility with the send command (provided by MH/nmh): -mime -nomime -msgid -nomsgid -watch -nowatch -verbose -noverbose -draftmessage=<string> -draftf=<string> -draftfolder=<string> -nodraftfolder -draftm=<string> -draft -alias=<string> -aliasesfile=<string> -filter=<string> -nofilter -format -noformat -forward -noforward -push -nopush -width=<num> -split=<num> -version -help -hencode -nohencode -library=<string> -server=<string> -client=<string> -bs -f=<string> -t -v -odb -odi -oem -oi -i -om -m -odq -q -bp -J -h -s=<string> COPYRIGHT
IM (Internet Message) is copyrighted by IM developing team. You can redistribute it and/or modify it under the modified BSD license. See the copyright file for more details. IM151 2011-05-25 IMPUT(1p)
All times are GMT -4. The time now is 02:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy