I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin
if i find feedthru_pin want to insert !! at the... (7 Replies)
Hi,
I know how to use awk to search some expressions like five consecutive numbers, , this is easy.
However, how do I make awk print the pattern that is been matched?
For example:
input: usa,canada99292,japan222,france59664,egypt223
output:99292,59664 (6 Replies)
Hi All,
I am trying to alter all lines between EXEC SQL and END-EXEC that have an INCLUDE in them.
The following code
search="INCLUDE "
cp -f ${WORK}/$file.in ${WORK}/$file.wrk2
for item in `echo $search `; do
> ${WORK}/$file.wrk1
awk -vITEM="$item" '{
if ( $0... (3 Replies)
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
I am trying to combine lines with these conditions:
1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text.
2. If condition1 is met then continue to combine lines through a line that ends with a semicolon.
3. Ignore case when matching patterns and remove any... (5 Replies)
Hi
I am using Solaris 5.10 & ksh
Wanted to loop through a pattern file by reading it and passing it to the awk to match that value present in column 1 of rawdata.txt , if so print column 1 & 2 in to Avlblpatterns.txt. Using the following code but it seems some mistakes and it is running for... (2 Replies)
I have this fileA
TEST FILE ABC
this file contains ABC;
TEST FILE DGHT this file contains DGHT;
TEST FILE 123
this file contains ABC,
this file contains DEF,
this file contains XYZ,
this file contains KLM
;
I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
LEARN ABOUT DEBIAN
z88dk-copt
copt(1) z88 Development Kit copt(1)NAME
copt - peephole optimizer
SYSNOPIS
copt file ...
DESCRIPTION
copt is a general-purpose peephole optimizer. It reads code from its standard input and writes an improved version to its standard output.
copy reads the named files for its optimizations, which are encoded as follows:
<pattern for input line 1>
<pattern for input line 2>
...
<pattern for input line n>
=
<pattern for output line 1>
<pattern for output line 2>
...
<pattern for output line m>
<blank line>
Pattern matching uses literal string comparison, with one exception: ``%%'' matches the ``%'' character, and ``%'' followed by a digit
matches everything up to the next occurrence of the next pattern character, though all occurrences of %n must denote the same string. For
example, the pattern ``%1=%1.'' matches exactly those strings that begin with a string X, followed by a ``='' (the first), followed by a
second occurrence of X, followed by a period. In this way, the input/output pattern
mov $%1,r%2
mov *r%2,r%2
=
mov %1,r%2
commands copt to replace runs like
mov $_a,r3
mov *r3,r3
with
mov _a,r3
Note that a tab or newline can terminate a %n variable.
copt compares each run of input patterns with the current input instruction and its predecessors. If no match is found, it advances to the
next input instruction and tries again. Otherwise, it replaces the input instructions with the corresponding output patterns, pattern vari-
ables instantiated,and resumes its search with the first instruction of the replacement. copt matches input patterns in reverse order to
cascade optimizations without backing up.
BUGS
Errors in optimization files are always possible.
SEE ALSO z88dk(1), z88dk-zcc(1), z88dk-z80asm(1), z88dk-appmake(1), z88dk-copt(1).
AUTHOR
z88dk was written by Dominic Morris <dom@z88dk.org>, and others.
01 December 2009 copt(1)