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
MORE(1) User Commands MORE(1)
NAME
more -- file perusal filter for crt viewing
SYNOPSIS
more [-dlfpcsu] [-num] [+/pattern] [+linenum] [file ...]
DESCRIPTION
more is a filter for paging through text one screenful at a time. This version is especially primitive. Users should realize that less(1)
provides more(1) emulation plus extensive enhancements.
OPTIONS
Command-line options are described below. Options are also taken from the environment variable MORE (make sure to precede them with a dash
(``-'')) but command line options will override them.
-num This option specifies an integer which is the screen size (in lines).
-d more will prompt the user with the message "[Press space to continue, 'q' to quit.]" and will display "[Press 'h' for instructions.]"
instead of ringing the bell when an illegal key is pressed.
-l more usually treats ^L (form feed) as a special character, and will pause after any line that contains a form feed. The -l option will
prevent this behavior.
-f Causes more to count logical, rather than screen lines (i.e., long lines are not folded).
-p Do not scroll. Instead, clear the whole screen and then display the text.
Notice that this option is switched on automatically if the executable is named page.
-c Do not scroll. Instead, paint each screen from the top, clearing the remainder of each line as it is displayed.
-s Squeeze multiple blank lines into one.
-u Suppress underlining.
+/ The +/ option specifies a string that will be searched for before each file is displayed.
+num Start at line number num.
COMMANDS
Interactive commands for more are based on vi(1). Some commands may be preceded by a decimal number, called k in the descriptions below. In
the following descriptions, ^X means control-X.
h or ? Help: display a summary of these commands. If you forget all the other commands, remember this one.
SPACE Display next k lines of text. Defaults to current screen size.
z Display next k lines of text. Defaults to current screen size. Argument becomes new default.
RETURN Display next k lines of text. Defaults to 1. Argument becomes new default.
d or ^D Scroll k lines. Default is current scroll size, initially 11. Argument becomes new default.
q or Q or INTERRUPT
Exit.
s Skip forward k lines of text. Defaults to 1.
f Skip forward k screenfuls of text. Defaults to 1.
b or ^B Skip backwards k screenfuls of text. Defaults to 1. Only works with files, not pipes.
' Go to place where previous search started.
= Display current line number.
/pattern Search for kth occurrence of regular expression. Defaults to 1.
n Search for kth occurrence of last r.e. Defaults to 1.
!<cmd> or :!<cmd>
Execute <cmd> in a subshell
v Start up an editor at current line. The editor is taken from the environment variable VISUAL if defined, or EDITOR if VISUAL is
not defined, or defaults to "vi" if neither VISUAL nor EDITOR is defined.
^L Redraw screen
:n Go to kth next file. Defaults to 1.
:p Go to kth previous file. Defaults to 1.
:f Display current file name and line number
. Repeat previous command
ENVIRONMENT
More utilizes the following environment variables, if they exist:
MORE This variable may be set with favored options to more.
SHELL Current shell in use (normally set by the shell at login time).
TERM Specifies terminal type, used by more to get the terminal characteristics necessary to manipulate the screen.
SEE ALSO
vi(1), less(1)
AUTHORS
Eric Shienbrood, UC Berkeley
Modified by Geoff Peck, UCB to add underlining, single spacing
Modified by John Foderaro, UCB to add -c and MORE environment variable
HISTORY
The more command appeared in 3.0BSD. This man page documents more version 5.19 (Berkeley 6/29/88), which is currently in use in the Linux
community. Documentation was produced using several other versions of the man page, and extensive inspection of the source code.
AVAILABILITY
The more command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
util-linux February 2011 util-linux