01-16-2011
Awesome thanks :-)
Is it possible to get the line number of the occurrence along with the output? from the above example, "this is the line1 which is suppose to be grepped and displayed as a output." is at second line. So the output should be as,
2: line one found
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am using AIX and ksh.
I need to display the contents of a file that has a pid (process id). Because the file is open, it doesn't have the line feed or new line, so for some reason if I do this:
`cat $pid` , where $pid is the name of the fully qualified file, it displays
test3.sh: 426110:... (1 Reply)
Discussion started by: Gato
1 Replies
2. Shell Programming and Scripting
Hi,
I have two files say xxx.txt and yyy.txt. xxx.txt is with list of patterns within double quotes. Eg.
"this is the line1"
"this is the line2"
The yyy.txt with lot of lines. eg:
"This is a test message which contains rubbish information just to fill the page which is of no use. this is... (3 Replies)
Discussion started by: abinash
3 Replies
3. Shell Programming and Scripting
We have 2 file XML files - FILE1.XML and FILE2.xml - we need copy the contents of FILE1.XML and replace in FILE2.xml pattern "<assignedAttributeList></assignedAttributeList>"
FILE1.XML
1. <itemList>
2. <item type="Manufactured">
3. <resourceCode>431048</resourceCode>
4. ... (0 Replies)
Discussion started by: balrajg
0 Replies
4. Shell Programming and Scripting
Hi All,
Need help on this
I have 2 files
one file file1 which has several entries as :
define service{
hostgroup_name !host1,!host5,!host6,.*
service_description check_nrpe
}
define service{
hostgroup_name !host2,!host4,!host6,.*
service_description check_opt
}
another... (2 Replies)
Discussion started by: namitai
2 Replies
5. Shell Programming and Scripting
Hello,
I am trying to get output from FILE2 that excludes servers from list FILE1. I've tried a for loop with no success. Any ideas how to go about this?
FILE1 contains:
server1
server2
server3
server4
server5
FILE2 contains:
server1:ERROR:user1: error message... (2 Replies)
Discussion started by: LinuxRacr
2 Replies
6. Shell Programming and Scripting
This is Input - starts with Storage Group Name and ends with Shareable and the loop continues all I need is Storage group name and Alu numbers in the below output format requested.
Storage Group Name: abcd
Storage Group UID: 00:00:000:00:0:0:0
HBA/SP Pairs:
HBA UID ... (6 Replies)
Discussion started by: maddysa
6 Replies
7. Shell Programming and Scripting
Hi Friends,
This is the only solution to my task. So, any help is highly appreciated.
I have a file
cat input1.bed
chr1 100 200 abc
chr1 120 300 def
chr1 145 226 ghi
chr2 567 600 unix
Now, I have another file by name
input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies
8. UNIX for Dummies Questions & Answers
<tr><td bgcolor=#D7EBAD><b>Instructions :</b></td>
<td>`cat temp.txt`</td></tr>
Hi Experts,
I have an requirement of displaying file contents in HTML mail , for which am using the above approach, Where as the output is kind of not as expected.
If there are 5 lines in the file, in the... (4 Replies)
Discussion started by: scott_cog
4 Replies
9. Shell Programming and Scripting
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
10. UNIX for Beginners Questions & Answers
I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this.
--- Post updated at... (5 Replies)
Discussion started by: Kentlee65
5 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)