Sponsored Content
Operating Systems Linux Get a specific line number from a text file Post 302440676 by barryxian on Wednesday 28th of July 2010 01:55:56 AM
Old 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

jumping to a specific line in a text file

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

Adding a columnfrom a specifit line number to a specific line number

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

Adding specific text and spaces to each line in a text file

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

extract the lines between specific line number from a text file

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

Inputting text to a specific line of a file

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

Comparing a number in a text file with a specific value

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

Deleting cells that contain a specific number only from a space delimited text file

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

write specific line number in file

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

Extract specific line in an html file starting and ending with specific pattern to a text file

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

Grep pattern after specific line number in a file

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
RRDXPORT(1)							      rrdtool							       RRDXPORT(1)

NAME
rrdxport - Export data in XML format based on data from one or several RRD SYNOPSIS
rrdtool xport [-s|--start seconds] [-e|--end seconds] [-m|--maxrows rows] [--step value] [--daemon address] [DEF:vname=rrd:ds-name:CF] [CDEF:vname=rpn-expression] [XPORT:vname[:legend]] DESCRIPTION
The xport function's main purpose is to write an XML formatted representation of the data stored in one or several RRDs. It can also extract numerical reports. If no XPORT statements are found, there will be no output. -s|--start seconds (default end-1day) The time when the exported range should begin. Time in seconds since epoch (1970-01-01) is required. Negative numbers are relative to the current time. By default one day worth of data will be printed. See also AT-STYLE TIME SPECIFICATION section in the rrdfetch documentation for a detailed explanation on how to specify time. -e|--end seconds (default now) The time when the exported range should end. Time in seconds since epoch. See also AT-STYLE TIME SPECIFICATION section in the rrdfetch documentation for a detailed explanation of ways to specify time. -m|--maxrows rows (default 400 rows) This works like the -w|--width parameter of rrdgraph. In fact it is exactly the same, but the parameter was renamed to describe its purpose in this module. See rrdgraph documentation for details. --step value (default automatic) See rrdgraph documentation. --daemon address Address of the rrdcached daemon. If specified, a "flush" command is sent to the server before reading the RRD files. This allows rrdtool to return fresh data even if the daemon is configured to cache values for a long time. For a list of accepted formats, see the -l option in the rrdcached manual. rrdtool xport --daemon unix:/var/run/rrdcached.sock ... --enumds The generated xml should contain the data values in enumerated tags. <v0>val</v0><v1>val</v1> DEF:vname=rrd:ds-name:CF See rrdgraph documentation. CDEF:vname=rpn-expression See rrdgraph documentation. XPORT:vname::legend At least one XPORT statement should be present. The values referenced by vname are printed. Optionally add a legend. Output format The output is enclosed in an xport element and contains two blocks. The first block is enclosed by a meta element and contains some meta data. The second block is enclosed by a data element and contains the data rows. Let's assume that the xport command looks like this: rrdtool xport --start now-1h --end now DEF:xx=host-inout.lo.rrd:output:AVERAGE DEF:yy=host-inout.lo.rrd:input:AVERAGE CDEF:aa=xx,yy,+,8,* XPORT:xx:"out bytes" XPORT:aa:"in and out bits" The resulting meta data section is (the values will depend on the RRD characteristics): <meta> <start>1020611700</start> <step>300</step> <end>1020615600</end> <rows>14</rows> <columns>2</columns> <legend> <entry>out bytes</entry> <entry>in and out bits</entry> </legend> </meta> The resulting data section is: <data> <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row> <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row> <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020615600</t><v>NaN</v><v>NaN</v></row> </data> EXAMPLE 1 rrdtool xport DEF:out=if1-inouts.rrd:outoctets:AVERAGE XPORT:out:"out bytes" EXAMPLE 2 rrdtool xport DEF:out1=if1-inouts.rrd:outoctets:AVERAGE DEF:out2=if2-inouts.rrd:outoctets:AVERAGE CDEF:sum=out1,out2,+ XPORT:out1:"if1 out bytes" XPORT:out2:"if2 out bytes" XPORT:sum:"output sum" ENVIRONMENT VARIABLES
The following environment variables may be used to change the behavior of "rrdtool xport": RRDCACHED_ADDRESS If this environment variable is set it will have the same effect as specifying the "--daemon" option on the command line. If both are present, the command line argument takes precedence. AUTHOR
Tobias Oetiker <tobi@oetiker.ch> 1.4.3 2008-09-25 RRDXPORT(1)
All times are GMT -4. The time now is 06:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy