Hi there,
We have been given a bit of coursework using awk on html pages. Without giving too much away and risking the wrath of the plagerism checks, I can say we need to deal with certain html elements.
There may be several of these elements on one line. My question is, if there are more... (1 Reply)
I have a situation where I need to search for multiple strings (error messages) such as 'aborted' 'file not found' etc in directory having logs. I have put all the error messages in a text file and using the command.
grep -f <textfile> <filetobegrepped>
I'm doing this thru a script where I... (5 Replies)
Hi All,
I have a file in which i have to search for a pattern from the beginning of the file and if the pattern is found , then i have to perform a reverse search from that line to the beginning of the file to get the first occurrence of another pattern.
sample input file
hey
what are you... (8 Replies)
Hi
I am having a file like this
FILE1
#####################
C16ROTINV_
REFCLK_RXL
RXBCLK32_R
REFCLK_TXL
CLK8_TXLIN
RXBCLK32_R
DCLK_TXLIN
CLK32D_TXL
RXACLK32_R
##################### (3 Replies)
Hi,
I have code like:
Output it is comming as:
Rels: WM2
Rels: WG2
Rels: 5
- pre/prods.pl
Rels: 6
Rels: 7
Rels: 8
Rels: 10
Rels: Int
But i want only "Rels: 5" pattern Just above "- pre/prods.pl".
By... (7 Replies)
Hi,
I am using sub to remove blank spaces and one pattern(=>) from the input string. It works fine when I am using two sub functions for the same. However it is giving error while I am trying to remove both spaces and pattern using one single sub function.
Working:
$ echo " OK => " |awk... (2 Replies)
Hi forum,
Can you please help me understand how to look for and replace the below pattern (containing line breaks) and return a new result?
Rules: Must match the 3 line pattern and return a 1 line result.
I have found solutions with sed, but it seems that sed installed in my system is... (5 Replies)
I need to check if 2 values exists in the file and if they are equal print 0.
output.txt:
------------
1 2 3 4 5 6
Inputs:
a=1
b=2
My pattern matching code works but I am trying to set a counter if both the pattern matches which does not work.If the count > 0,then I want to... (3 Replies)
Hello,
I have attached 2 files
1) Original_table_definition.txt => which has definition of 3 tables
2) describe_table_output.txt => which has again 3 tables definition gotten thorugh doing a show table or describe table way.
Now difference between 3 tables are that tablea has no... (2 Replies)
Discussion started by: nv186000
2 Replies
LEARN ABOUT OPENDARWIN
case
case(n) Tcl Built-In Commands case(n)
__________________________________________________________________________________________________________________________________________________NAME
case - Evaluate one of several scripts, depending on a given value
SYNOPSIS
case string ?in? patList body ?patList body ...?
case string ?in? {patList body ?patList body ...?}
_________________________________________________________________DESCRIPTION
Note: the case command is obsolete and is supported only for backward compatibility. At some point in the future it may be removed
entirely. You should use the switch command instead.
The case command matches string against each of the patList arguments in order. Each patList argument is a list of one or more patterns.
If any of these patterns matches string then case evaluates the following body argument by passing it recursively to the Tcl interpreter
and returns the result of that evaluation. Each patList argument consists of a single pattern or list of patterns. Each pattern may con-
tain any of the wild-cards described under string match. If a patList argument is default, the corresponding body will be evaluated if no
patList matches string. If no patList argument matches string and no default is given, then the case command returns an empty string.
Two syntaxes are provided for the patList and body arguments. The first uses a separate argument for each of the patterns and commands;
this form is convenient if substitutions are desired on some of the patterns or commands. The second form places all of the patterns and
commands together into a single argument; the argument must have proper list structure, with the elements of the list being the patterns
and commands. The second form makes it easy to construct multi-line case commands, since the braces around the whole list make it unneces-
sary to include a backslash at the end of each line. Since the patList arguments are in braces in the second form, no command or variable
substitutions are performed on them; this makes the behavior of the second form different than the first form in some cases.
SEE ALSO
switch(n)
KEYWORDS
case, match, regular expression
Tcl 7.0 case(n)