01-06-2011
Scrutinzer
Sorry for the delayed response.
I didn't get an answer in time (had to rebuild a server over the holidays; needed the scripts working), so I implemented 32 IF statements. Works fine, but u.g.l.y.
Your solution is elegant. My need is a bit more complicated (I posted a simple example) but that's a minor problem on my side. I will use it, and re-implement my ugly code before the next execution. I have a similar need coming up in a few weeks, I can use it again.
Very RPG, incidentally, for the older scripters among us.
Thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi, how would we replace a few patterns on the same line with a change of it's own..using visual block on vim editor.
ie a file contains lines such as the following:
abccss (dfrss)) emailkk
abdcss (dfrss)) dmailkk
Using visual block once, replacement is indeed to get the following output:... (0 Replies)
Discussion started by: Manan
0 Replies
2. Shell Programming and Scripting
Hi friends,
I have written script that will search & display the block of sql statement. Since there are many blocks of sql statement i am finding it difficult to distinguish between them. The below is the sed command & its result
exec sql
abc
abc
abc... (2 Replies)
Discussion started by: frozensmilz
2 Replies
3. Shell Programming and Scripting
Hello,
I've been racking my brain trying to find a good way to accomplish a task. I need to insert a block of text into a file in the format of
FirewallRuleSet proxy-users {
FirewallRule allow to 0.0.0.0/0
}
I need to insert this block of text (which could have sed special... (2 Replies)
Discussion started by: 0xception
2 Replies
4. UNIX for Advanced & Expert Users
I was reading a book on UNIX internals "The design of the UNIX Operating system." There are two memory structures that are confusing me:
1) Buffer cache
2) Inode cache
My questions are
1) Does a process get both buffer cache and Indoe cache allocated when it opens/creates a file?
2) if no,... (1 Reply)
Discussion started by: sreeharshasn
1 Replies
5. UNIX for Advanced & Expert Users
I have a "main" file which has blocks of data for each user defined by tags BEGIN and END.
BEGIN
ID_NUM:24879
USER:abc123
HOW:47M
CMD1:xyz1
CMD2:arp2
STATE:active
PROCESS:id60
END
BEGIN
ID_NUM:24880
USER:def123
HOW:4M
CMD1:xyz1
CMD2:xyz2
STATE:running
PROCESS:id64
END (7 Replies)
Discussion started by: grep_me
7 Replies
6. Shell Programming and Scripting
I want to process a file block by block using sed, and if that block does not contain two patterns, then that complete block has to be printed.
See below for the example data.
................................server 1...............................
running process 1
running... (8 Replies)
Discussion started by: Kesavan
8 Replies
7. Shell Programming and Scripting
I want to search for a block of text in httpd.conf that between two strings and comment it. There are multiple blocks with "<Directory.. and </Directory>"
<Directory "${ORACLE_INSTANCE}/config/${COMPONENT_TYPE}/${COMPONENT_NAME}/htdocs">
#
# Possible values for the Options directive are... (3 Replies)
Discussion started by: kchinnam
3 Replies
8. Shell Programming and Scripting
I want to extract XML block surrounding search string
Ex: print XML block for string "myapp1-ear" surrounded by "<application> .. </application>"
Input XML:
<?xml version="1.0" encoding="UTF-8"?>
<deployment-request>
<requestor>
<first-name>kchinnam</first-name>
... (16 Replies)
Discussion started by: kchinnam
16 Replies
9. UNIX for Beginners Questions & Answers
How to grep for searching a string within a begin and end pattern of a file.
Sent from my Redmi 3S using Tapatalk (8 Replies)
Discussion started by: Baishali
8 Replies
10. Shell Programming and Scripting
Hi,
I have a scenario where I want to display the output based on the pattern search between the start and end of a block in a file, we can have multiple start and end blocks in a file.
Example give below, we need to search between the start block abc and end block def in a file, after that... (5 Replies)
Discussion started by: G.K.K
5 Replies
LEARN ABOUT OSX
weblatency.d
weblatency.d(1m) USER COMMANDS weblatency.d(1m)
NAME
weblatency.d - website latency statistics. Uses DTrace.
SYNOPSIS
weblatency.d
DESCRIPTION
This prints statistics for hostnames that browers have set GET requests for, in particular latency by hostname.
The latency measured is from the browser sending the GET request to when the browser begins to recieve the response. It is an overall
response time for the client, and encompasses connection speed delays, DNS lookups, proxy delays, and web server response time.
This is written as an experimental tool, and may not work at all with your browser.
Since this uses DTrace, only users with root privileges can run this command.
EXAMPLES
Print report after Ctrl-C is hit,
# weblatency.d
FIELDS
HOST hostname from URL
NUM number of GETs
AVGTIME(ms)
Average time for response, ms
MAXTIME(ms)
Maximum time for response, ms
NOTES
See the source code for the "BROWSER" variable, which sets the browser to trace (currently set to "mozilla-bin").
IDEA
Bryan Cantrill (who wrote an elegant version for Sol 10 update 1)
DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver-
bose descriptions explaining the output.
EXIT
weblatency.d will sample until Ctrl-C is hit.
AUTHOR
Brendan Gregg [Sydney, Australia]
SEE ALSO
dtrace(1M)
version 0.60 Nov 30, 2005 weblatency.d(1m)