06-30-2013
you can also Go to line 100 (makes line 100 your current line)
in command mode :
100G
(if you don't specify a line number, G will bring you at the end of the file)
Then launch your search from there depending whether you want to look forward or backward for your RE:
/RE
or
?RE
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My data is xml'ish (here is an excerpt) :-
<bag name="mybag1" version="1.0"/>
<contents id="coins"/>
<bag name="mybag2" version="1.1"/>
<contents id="clothes"/>
<contents id="shoes"/>
<bag name="mybag3" version="1.6"/>
I want to delete line containing mybag2 and its subsequent... (5 Replies)
Discussion started by: repudi8or
5 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am new to this forum and i would like to get help in this issue.
I have a file 1.txt as shown:
apple
banana
orange
apple
grapes
banana
orange
grapes
orange
....
Now i would like to search for pattern say apple or orange and then put a # at the beginning of the pattern... (2 Replies)
Discussion started by: imas
2 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I think you ppl did not get my question correctly, let me explain
I have 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
... (1 Reply)
Discussion started by: imas
1 Replies
4. Shell Programming and Scripting
example
- shsk
mss-sdsd-asd
i need a command which will search for staring word not others
it should search only -shsk
cat filename | grep '-'
will search whole '-' in the file but i need to search only staring '-'
thank u
revenna (1 Reply)
Discussion started by: revenna
1 Replies
5. Shell Programming and Scripting
Dear All,
i want to search particular string and want to replance next line value.
following is the test file.
search string is
tmp,???
,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50
tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies
6. Shell Programming and Scripting
Dear all,
How can I print line starting with certain string together with its following line. Example is as follows:
Input file:
@M01596:22:000000000-A7YH7:1:1101:16615:1070 2:N:0:1... (2 Replies)
Discussion started by: huiyee1
2 Replies
7. Shell Programming and Scripting
Hello,
I'm works on Ubuntu server
My goal : I would like to read file line per line, but i want to started at the end of file.
Currently, I use instructions :
while read line;
do
COMMAND
done < /var/log/apache2/access.log
But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies
8. UNIX for Dummies Questions & Answers
e.g.
File name: File.txt
cat File.txt
Result:
#INBOUND_QUEUE=FAQ1
INBOUND_QUEUE=FAQ2
I want to get the value for one which is not commented out.
Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies
9. UNIX for Beginners Questions & Answers
im trying to search for a WORD in a file which
begins with a number
followed by a hypen
follwed multiple words
and end with a dot "."
and pront the entire line which matches the above.
Please note that there is a space at the begining of each line
i/p file
19458 00000-CONTROL-PARA.... (5 Replies)
Discussion started by: anijan
5 Replies
10. Shell Programming and Scripting
Hi,
i have a file with multiple entries. After some tests with sed i managed to get the file output as follows:
lsn=X-LINK-IN0,apc=661:0,state=avail,avail/links=1/1,
00,2110597,2094790,0,81,529,75649011,56435363,
lsn=TM1ITP1-AM1ITP1-LS,apc=500:0,state=avail,avail/links=1/1,... (5 Replies)
Discussion started by: nms
5 Replies
view(1) General Commands Manual view(1)
Name
view - displays a file using the vi commands
Syntax
view [-t tag] [-r] [+command] [-l] [-wn] [-x] name...
Description
The command displays a text file. The command and the command run almost the same code except that in changes to a file are not allowed.
It is possible to get to the command mode of from within both.
The following is a list of some of the commands. See the vi Beginner's Reference Card and the "Introduction to Display Editing with vi" in
the Supplementary Documents, Volume 1: General User for more details that can be helpful for using
Screen Control Commands
<CTRL/L> Reprints current screen.
<CTRL/Y> Exposes one more line at top of screen.
<CTRL/E> Exposes one more line at bottom of screen.
Paging Commands
<CTRL/F> Pages forward one screen.
<CTRL/B> Pages back one screen.
<CTRL/D> Pages down half screen.
<CTRL/U> Pages up half screen.
Cursor Positioning Commands
j Moves cursor down one line, same column.
k Moves cursor up one line, same column.
h Moves cursor back one character.
l Moves cursor forward one character.
<RETURN> Moves cursor to beginning of next line.
0 Moves cursor to beginning of current line.
$ Moves cursor to end of current line.
<SPACE> Moves cursor forward one character.
nG Moves cursor to beginning of line n. Default is last line of file.
/pattern Moves cursor forward to next occurrence of pattern.
?pattern Moves cursor backward to next occurrence of pattern.
n Repeats last / or ? pattern search.
Exiting view
ZZ Exits
:q Quits session.
Options
-t tag Specifies a list of tag files. The tag files are preceded by a backslash () and are separated by spaces. The tag option should
always be the first entry.
+command Tells the editor to begin by executing the specified command. An example would be +/pattern that would search for a pattern.
-l Sets the showmatch and lisp options for viewing LISP code..
-r Retrieves the last saved version of the name'd file in the event of a system crash. If no file is specified, a list of saved
files is produced.
-wn Sets the default window size to n. This option is useful for starting in a small window on dialups. The -x option is available
only if the Encryption layered product is installed.
-x Causes to prompt for a key. The key is used to encrypt and decrypt the contents of the file. If the file has been encrypted
with one key, you must use the same key to decrypt the file.
See Also
edit(1), ex(1), vi(1)
The Little Gray Book: An ULTRIX Primer
The Big Gray Book: The Next Step with ULTRIX
"An Introduction to Display Editing with vi" in the Supplementary Documents, Volume 1: General User
view(1)