05-13-2009
Quote:
Originally Posted by
radoulov
In your sample there are no matching groups for the numbers in your example data, that's what I mean ...
There is matchings see below- At least below is matched. In this way if no matching than output will be No matched. If match then output will be accordingly.
935
303455 number belongs to below group
start end
Group0125 935300 935399
Please help.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi im new to unix and need to find a way to grep the top 5 numbers in a file and put them into another file. For example my file looks like this
abcdef 50000
abcdef 45000
abcdef 40000
abcdef 35000
abcdef 30000
abcdef 25000
abcdef 20000
abcdef 15000
abcdef 10000
and so on...
How can... (1 Reply)
Discussion started by: ProgChick2oo9
1 Replies
2. Shell Programming and Scripting
I have a text file in the following format
....
START
1,1
2,1
3,1
..
..
9,1
10,1
END
....
I want to change to the output to
....
START
1,1
2,1
3,1
.. (4 Replies)
Discussion started by: VNR
4 Replies
3. Shell Programming and Scripting
I am trying to add free and used memory (so that i can compute percentage used)of remote nodes using shell script. I use the openssh-server,expect tool and ssh script.
1)login.txt (info of nodes):
ip1|username|password
ip2|username|password
.
.
.
3)sshlogin.sh
#!/bin/bash ... (1 Reply)
Discussion started by: marmik1903
1 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I have a column where there are values from 1 to 150.
I want to get the frequency of values in the following ranges:
1-5
6-10
11-15
....
....
....
146-150
How can I do this in a for loop?
Thanks,
Guss (1 Reply)
Discussion started by: Gussifinknottle
1 Replies
5. UNIX for Dummies Questions & Answers
Hi I have a data file with two columns which looks like:
1 42
2 40
3 55
4 50
5 38
6 49
7 33
8 46
9 39
10 33
11 33
12 26
13 46
14 44
15 55
16 54
17 30
18 32 (7 Replies)
Discussion started by: marhuu
7 Replies
6. Shell Programming and Scripting
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. Shell Programming and Scripting
I am trying to make a script to read marks from a file then find out how many of them are above 40 (passing marks). However my script is getting stuck at "read num". I dont understand whats the problem. Any help will be much appreciated.
#!/bin/bash
set -x
count=0; countP=0; PASSMK=40... (6 Replies)
Discussion started by: vish6251
6 Replies
8. Shell Programming and Scripting
Hi,
I'm trying to match a filename that could be called anything from vout001 to vout252 and was trying to do a small test but I'm not getting the result I thought I would..
Can some one tell me what I'm doing wrong?
*****@********>echo $mynumber ... (4 Replies)
Discussion started by: Jazmania
4 Replies
9. Shell Programming and Scripting
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies
10. UNIX for Beginners Questions & Answers
Hello,
I have the following script
while read id fraction
do
sambamba -h -f bam -t 10 --subsampling-seed=50 -s $frac ${id}.bam -o ${id}.out.bam
done < fraction.txt
where fraction.txt has two columns (id,fraction) and 50 rows
I am unable to run this as bash is not able to read the second... (2 Replies)
Discussion started by: nans
2 Replies
LEARN ABOUT REDHAT
regsub
regsub(n) Tcl Built-In Commands regsub(n)
__________________________________________________________________________________________________________________________________________________
NAME
regsub - Perform substitutions based on regular expression pattern matching
SYNOPSIS
regsub ?switches? exp string subSpec varName
_________________________________________________________________
DESCRIPTION
This command matches the regular expression exp against string, and it copies string to the variable whose name is given by varName. (Reg-
ular expression matching is described in the re_syntax reference page.) If there is a match, then while copying string to varName the por-
tion of string that matched exp is replaced with subSpec. If subSpec contains a ``&'' or `` '', then it is replaced in the substitution
with the portion of string that matched exp. If subSpec contains a ``
'', where n is a digit between 1 and 9, then it is replaced in the
substitution with the portion of string that matched the n-th parenthesized subexpression of exp. Additional backslashes may be used in
subSpec to prevent special interpretation of ``&'' or `` '' or ``
'' or backslash. The use of backslashes in subSpec tends to interact
badly with the Tcl parser's use of backslashes, so it's generally safest to enclose subSpec in braces if it includes backslashes.
If the initial arguments to regexp start with - then they are treated as switches. The following switches are currently supported:
-all All ranges in string that match exp are found and substitution is performed for each of these ranges. Without this switch only
the first matching range is found and substituted. If -all is specified, then ``&'' and ``
'' sequences are handled for each
substitution using the information from the corresponding match.
-expanded Enables use of the expanded regular expression syntax where whitespace and comments are ignored. This is the same as speci-
fying the (?x) embedded option (see METASYNTAX, below).
-line Enables newline-sensitive matching. By default, newline is a completely ordinary character with no special meaning. With
this flag, `[^' bracket expressions and `.' never match newline, `^' matches an empty string after any newline in addition
to its normal function, and `$' matches an empty string before any newline in addition to its normal function. This flag is
equivalent to specifying both -linestop and -lineanchor, or the (?n) embedded option (see METASYNTAX, below).
-linestop Changes the behavior of `[^' bracket expressions and `.' so that they stop at newlines. This is the same as specifying the
(?p) embedded option (see METASYNTAX, below).
-lineanchor Changes the behavior of `^' and `$' (the ``anchors'') so they match the beginning and end of a line respectively. This is
the same as specifying the (?w) embedded option (see METASYNTAX, below).
-nocase Upper-case characters in string will be converted to lower-case before matching against exp; however, substitutions specified by
subSpec use the original unconverted form of string. |
-start index |
Specifies a character index offset into the string to start matching the regular expression at. When using this switch, `^' will |
not match the beginning of the line, and A will still match the start of the string at index. index will be constrained to the |
bounds of the input string.
-- Marks the end of switches. The argument following this one will be treated as exp even if it starts with a -.
The command returns a count of the number of matching ranges that were found and replaced. See the manual entry for regexp for details on
the interpretation of regular expressions.
SEE ALSO
regexp(n), re_syntax(n)
KEYWORDS
match, pattern, regular expression, substitute
Tcl 8.3 regsub(n)