10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have 3-column tab separated data that looks like the following:
act of+n-a-large+vn-tell-v 0.067427
act_com of+n+n-a-large-manufacturer-n 0.129922
act-act_com-com in+n-j+vn-pass-aux-restate-v 0.364499666667
com nmod+n-j+ns-invader-n 0.527521
act_com-com obj+n-a-j+vd-contribute-v 0.091413... (2 Replies)
Discussion started by: owwow14
2 Replies
2. Shell Programming and Scripting
HI
I have a file with output as
System: cu=4 ent=0.1 mode=on
cu min u s w i
0 500 0.1 0.3 0.5 0.1
1 200 0.5 0.2 0.3 0.0
I need to grep the values of following column fields u, s, w and i from each row sum them up and store in a variable..:(
Please help.. (3 Replies)
Discussion started by: Priya Amaresh
3 Replies
3. Shell Programming and Scripting
Hi all,
I'll like to search a list of tems in a huge file and then output each of the terms to individual files. I know I can use grep -f list main.file to search them but how can I split the output into individual files? Thank you. (6 Replies)
Discussion started by: ivpz
6 Replies
4. Programming
I have 20 files that look pretty much like this:
0.01 1 3822 4.97379915032e-14 4.96982253992e-09 0
0.01 3822 1 4.97379915032e-14 4.96982253992e-09 0
0.01 2 502 0.00993165137406 993.165137406 0
0.01 502 2 0.00993165137406 993.165137406 0
0.01 4 33 0.00189645523539 189.645523539 0
0.01 33 4... (5 Replies)
Discussion started by: kayak
5 Replies
5. Shell Programming and Scripting
I have a file that is a sort library in the format:
##def title1
content1
stuff1
content2
stuff2
##enddef
##def title2
etc..
I want to grep def and content and pull some trailing context from content
so the result would look something like: (1 Reply)
Discussion started by: Moe.Wilensky
1 Replies
6. Shell Programming and Scripting
Hi All,
I'm trying to grep for 3 patterns in a string of gibberish. It so happens that each line is appended by a date/time stamp and i was able to figure out how to extract only the datetime.
here is the string..
i have to display
tinker tailor soldier spy
Please can some help... (2 Replies)
Discussion started by: Irishboy24
2 Replies
7. UNIX for Dummies Questions & Answers
Hello, I have a block of code (XML) that I would like to grep for certain information. The basic format of the XML is the following repeated a few hundred times, each time with a unique ID:
<Identifier ID="A" NAME="John Doe" AGE="32 Years" FAMILY="4" SEX="MALE"></Identfier>
I would like to... (6 Replies)
Discussion started by: jl487
6 Replies
8. Shell Programming and Scripting
I've got this command that I've been using to find strings on the same line, say I'm doing a search for name:
find . -name "*" | xargs grep -i "Doe" | grep -i "John" > output.txt
This gives me every line in a file that has John and Doe in it. I'm looking to add a OR operator for the second... (5 Replies)
Discussion started by: Rally_Point
5 Replies
9. Shell Programming and Scripting
Is there anyway you can grep using multiple wildcards? When I run the below line the results return fine;
grep 12345 /usr/local/production/soccermatchplus/distributor/clients/*/out/fixtures.xml | awk -F/ '{print $8}'
However ideally, I need it to grep for;
grep 12345... (3 Replies)
Discussion started by: JayC89
3 Replies
10. Shell Programming and Scripting
I am having a heck of a time trying to write a script that will grep for multiple strings in a single file. I am really at my wits end here and I am hoping to get some feedback here.
Basic information:
OS: Solaris 9
Shell: KSH
Oracle Database server
I was trying to grep through a file... (5 Replies)
Discussion started by: thecoffeeguy
5 Replies
FAIL(9) BSD Kernel Developer's Manual FAIL(9)
NAME
KFAIL_POINT_CODE, KFAIL_POINT_RETURN, KFAIL_POINT_RETURN_VOID, KFAIL_POINT_ERROR, KFAIL_POINT_GOTO, fail_point, DEBUG_FP -- fail points
SYNOPSIS
#include <sys/fail.h>
KFAIL_POINT_CODE(parent, name, code);
KFAIL_POINT_RETURN(parent, name);
KFAIL_POINT_RETURN_VOID(parent, name);
KFAIL_POINT_ERROR(parent, name, error_var);
KFAIL_POINT_GOTO(parent, name, error_var, label);
DESCRIPTION
Fail points are used to add code points where errors may be injected in a user controlled fashion. Fail points provide a convenient wrapper
around user-provided error injection code, providing a sysctl(9) MIB, and a parser for that MIB that describes how the error injection code
should fire.
The base fail point macro is KFAIL_POINT_CODE() where parent is a sysctl tree (frequently DEBUG_FP for kernel fail points, but various sub-
systems may wish to provide their own fail point trees), and name is the name of the MIB in that tree, and code is the error injection code.
The code argument does not require braces, but it is considered good style to use braces for any multi-line code arguments. Inside the code
argument, the evaluation of RETURN_VALUE is derived from the return() value set in the sysctl MIB. See SYSCTL VARIABLES below.
The remaining KFAIL_POINT_*() macros are wrappers around common error injection paths:
KFAIL_POINT_RETURN(parent, name)
is the equivalent of KFAIL_POINT_CODE(..., return RETURN_VALUE)
KFAIL_POINT_RETURN_VOID(parent, name)
is the equivalent of KFAIL_POINT_CODE(..., return)
KFAIL_POINT_ERROR(parent, name, error_var)
is the equivalent of KFAIL_POINT_CODE(..., error_var = RETURN_VALUE)
KFAIL_POINT_GOTO(parent, name, error_var, label)
is the equivalent of KFAIL_POINT_CODE(...,
{ error_var = RETURN_VALUE; goto label;})
SYSCTL VARIABLES
The KFAIL_POINT_*() macros add sysctl MIBs where specified. Many base kernel MIBs can be found in the debug.fail_point tree (referenced in
code by DEBUG_FP).
The sysctl variable may be set using the following grammar:
<fail_point> ::
<term> ( "->" <term> )*
<term> ::
( (<float> "%") | (<integer> "*" ) )*
<type>
[ "(" <integer> ")" ]
<float> ::
<integer> [ "." <integer> ] |
"." <integer>
<type> ::
"off" | "return" | "sleep" | "panic" | "break" | "print"
The <type> argument specifies which action to take:
off Take no action (does not trigger fail point code)
return Trigger fail point code with specified argument
sleep Sleep the specified number of milliseconds
panic Panic
break Break into the debugger, or trap if there is no debugger support
print Print that the fail point executed
The <float>% and <integer>* modifiers prior to <type> control when <type> is executed. The <float>% form (e.g. "1.2%") can be used to spec-
ify a probability that <type> will execute. The <integer>* form (e.g. "5*") can be used to specify the number of times <type> should be exe-
cuted before this <term> is disabled. Only the last probability and the last count are used if multiple are specified, i.e. "1.2%2%" is the
same as "2%". When both a probability and a count are specified, the probability is evaluated before the count, i.e. "2%5*" means "2% of the
time, but only 5 times total".
The operator -> can be used to express cascading terms. If you specify <term1>-><term2>, it means that if <term1> does not 'execute',
<term2> is evaluated. For the purpose of this operator, the return() and print() operators are the only types that cascade. A return() term
only cascades if the code executes, and a print() term only cascades when passed a non-zero argument.
EXAMPLES
sysctl debug.fail_point.foobar="2.1%return(5)"
21/1000ths of the time, execute code with RETURN_VALUE set to 5.
sysctl debug.fail_point.foobar="2%return(5)->5%return(22)"
2/100ths of the time, execute code with RETURN_VALUE set to 5. If that does not happen, 5% of the time execute code with
RETURN_VALUE set to 22.
sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
For 5 times, return 5. After that, 1/1000th of the time, return 22.
sysctl debug.fail_point.foobar="0.1%5*return(5)"
Return 5 for 1 in 1000 executions, but only 5 times total.
sysctl debug.fail_point.foobar="1%*sleep(50)"
1/100th of the time, sleep 50ms.
CAVEATS
It is easy to shoot yourself in the foot by setting fail points too aggressively or setting too many in combination. For example, forcing
malloc() to fail consistently is potentially harmful to uptime.
The sleep() sysctl setting may not be appropriate in all situations. Currently, fail_point_eval() does not verify whether the context is
appropriate for calling msleep().
AUTHORS
This manual page was written by Zach Loafman <zml@FreeBSD.org>.
BSD
May 10, 2009 BSD