07-28-2010
Hi! bankai & kurumi,
Thanks for your reply, yes, "grep -n" is good.
I am sorry for my unclear question.
Actually here is situation...
DEF is a procedure and will be called for several times.....
What I am going to do is,
I would like to add codings into "that file", and if any result from DEF is wrong, it will display that line number....
For example,
if the result from 2nd DEF is wrong, I will display that line number.....
which is line#5.
ABC
DEF --> 1st DEF
LLL
KKK
DEF --> 2nd DEF
PPP
DEF --> 3rd DEF
Also, in a test file, if we right click "View" and select "What Line Number?" then a line number will display.
Can we do this?
Thanks a lot!
10 More Discussions You Might Find Interesting
1. Programming
hi everybody!
i need to read a specific line from a text file using C. can any one suggest how to do it.
i m aware abt fread(), fwrite(), fseek()... but using these allows the pointer to be moved 1 character at a time. Is there a way i could jump directly to a line if i know the line number?... (4 Replies)
Discussion started by: mridula
4 Replies
2. Shell Programming and Scripting
Hi,
I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers.
To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
Discussion started by: Ezy
2 Replies
3. Shell Programming and Scripting
Hi,
I wanted to add specific text to each row in a text file containing three rows. Example:
0 8 7 6 5 5
7 8 9 0 7 9
7 8 9 0 1 2
And I want to add a 21 at the beginning of the first row, and blank spaces at the beginning of the second two rows. To get this:
21 0 8 7 6 5 5
7 8... (4 Replies)
Discussion started by: hertingm
4 Replies
4. Shell Programming and Scripting
Hi
I want to extract certain text between two line numbers like
23234234324 and
54446655567567
How do I do this with a simple sed or awk command?
Thank you.
---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ----------
found it:
sed -n '#1,#2p'... (1 Reply)
Discussion started by: return_user
1 Replies
5. UNIX for Dummies Questions & Answers
Hi all, I have a script which uses a basic line to add text into another file e.g.
grep -i test * >> test.txt
Is there a way I can get the output of the grep to output to a specific line in the text.txt for example output above the line starting "Bottom line..." (6 Replies)
Discussion started by: JayC89
6 Replies
6. UNIX for Dummies Questions & Answers
My project is to get a temperature reading from a refridgerator every 2 minutes and check to see if the door has been left open.
I don't yet have the mastery of Linux, being a complete noob, but I reckon I need a text file with the latest temperature reading in it. This I've managed to do by... (2 Replies)
Discussion started by: Fitch
2 Replies
7. UNIX for Dummies Questions & Answers
I have this space delimited large text file with more than 1,000,000+ columns and about 100 rows. I want to delete all the cells that consist of just 2 (leave 2's that are not by themselves intact):
File before modification
aa bb cc 2 NA100 dd
aa b1 c2 2 NA102 de
File after modification... (1 Reply)
Discussion started by: evelibertine
1 Replies
8. Shell Programming and Scripting
dear all,
i need your advice
i have sample script like this:
testing.sh
for i in {1..10}
do
echo testing $i
done
but i forgot create "#!/bin/bash" in above "for"
so i want output will like this
testing.sh
#!/bin/bash
for i in {1..10}
do
echo testing $i
done (2 Replies)
Discussion started by: zvtral
2 Replies
9. Shell Programming and Scripting
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies
10. Shell Programming and Scripting
Hi guys,
I am running a while loop in a script ro read a file line by line.
Now I want to run a grep only on the lines below the line I am that is being read by the while loop.
Eg:
If my while loop is on line 4 of the file, the grep only runs below line 4 and does not include line 1,2... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies
LEARN ABOUT DEBIAN
hobbitgraph.cfg
HOBBITGRAPH.CFG(5) File Formats Manual HOBBITGRAPH.CFG(5)
NAME
hobbitgraph.cfg - Configuration of the hobbitgraph CGI
SYNOPSIS
$BBHOME/etc/hobbitgraph.cfg
DESCRIPTION
hobbitgraph.cgi(1) uses the configuration file $BBHOME/etc/hobbitgraph.cfg to build graphs from the RRD files collected by Xymon.
FILE FORMAT
Each definition of a graph type begins with a "[SERVICE]" indicator, this is the name passed as the "service" parameter to hobbit-
graph.cgi(1). If the service name passed to hobbitgraph.cgi is not found, it will attempt to match the service name to a graph via the
TEST2RRD environment variable. So calling hobbitgraph.cgi with "service=cpu" or "service=la" will end up producing the same graph.
A graph definition needs to have a TITLE and a YAXIS setting. These are texts shown as the title of the graph, and the YAXIS heading
respectively. (The X-axis is always time-based).
If a fixed set of RRD files are used for the graph, you just write those in the RRDtool definitions. Note that Xymon keeps all RRD files
for a host in a separate directory per host, so you need not worry about the hostname being part of the RRD filename.
For graphs that use multiple RRD files as input, you specify a filename pattern in the FNPATTERN statement, and optionally a pattern of
files to exclude from the graph with EXFNPATTERN (see "[tcp]" for an example). When FNPATTERN is used, you can use "@RRDFN@" in the RRD-
tool definitions to pick up each filename. "@RRDIDX@" is an index (starting at 0) for each file in the set. "@RRDPARAM@" contains the first
word extracted from the pattern of files (see e.g. "[memory]" how this is used). "@COLOR@" picks a new color for each graph automatically.
The remainder of the lines in each definition are passed directly to the RRDtool rrd_graph() routine.
The following is an example of how the "la" (cpu) graph is defined. This is a simple definition that uses a single RRD-file, la.rrd:
[la]
TITLE CPU Load
YAXIS Load
DEF:avg=la.rrd:la:AVERAGE
CDEF:la=avg,100,/
AREA:la#00CC00:CPU Load Average
GPRINT:la:LAST: %5.1lf (cur)
GPRINT:la:MAX: %5.1lf (max)
GPRINT:la:MIN: %5.1lf (min)
GPRINT:la:AVERAGE: %5.1lf (avg)
Here is an example of a graph that uses multiple RRD-files, determined automatically at run-time via the FNPATTERN setting. Note how it
uses the @RRDIDX@ to define a unique RRD parameter per input-file, and the @COLOR@ and @RRDPARAM@ items to pick unique colors and a match-
ing text for the graph legend:
[disk]
FNPATTERN disk(.*).rrd
TITLE Disk Utilization
YAXIS % Full
DEF:p@RRDIDX@=@RRDFN@:pct:AVERAGE
LINE2:p@RRDIDX@#@COLOR@:@RRDPARAM@
-u 100
-l 0
GPRINT:p@RRDIDX@:LAST: %5.1lf (cur)
GPRINT:p@RRDIDX@:MAX: %5.1lf (max)
GPRINT:p@RRDIDX@:MIN: %5.1lf (min)
GPRINT:p@RRDIDX@:AVERAGE: %5.1lf (avg)
ADVANCED GRAPH TITLES
Normally the title of a graph is a static text defined in the hobbitgraph.cfg file. However, there may be situations where you want to use
different titles for the same type of graph, e.g. if you are incorporating RRD files from MRTG into Xymon. In that case you can setup the
TITLE definition so that it runs a custom script to determine the graph title. Like this:
TITLE exec:/usr/local/bin/graphitle
The /usr/local/bin/graphtitle command is then called with the hostname, the graphtype, the period string, and all of the RRD files used as
parameters. The script must generate one line of output, which is then used as the title of the graph.
ENVIRONMENT
TEST2RRD Maps service names to graph definitions.
NOTES
Most of the RRD graph definitions shipped with Xymon have been ported from the definitions in the larrd-grapher.cgi CGI from LARRD 0.43c.
SEE ALSO
hobbitserver.cfg(5), rrdtool(1), rrdgraph(1)
Xymon Version 4.2.3: 4 Feb 2009 HOBBITGRAPH.CFG(5)