Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Vi search starting from line n --- any trick for this ??? Post 302827499 by Don Cragun on Friday 28th of June 2013 11:11:58 PM
Old 06-29-2013
Quote:
Originally Posted by newbie_01
Hi all,

It does not seem to be possible to use vi to search from text from line n forward or backward or is there a not well known vi trick to do that?

What I am trying to do is for example I am on line 100 and I want to search from line 100 backward or forward for a specific text. Using / and ? seems to either start from the top and from the bottom and not from which line you are currently in.

Can anyone advise if what I am wanting to do is possible or not?

Thanks in advance.
The / and ? search commands in vi search forward and backward, respectively from the current line unless you specify a different range to be searched. The commands:
Code:
:line/RE
  and
:line?RE

will search forward and backward, respectively, for the regular expression RE searching from line number line, and the commands:
Code:
cnt/RE
  and
cnt?RE

search forward and backward, respectively, for the cntth occurrence of the regular expression RE searching from the current line.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to delete text from line starting pattern1 up to line before pattern2?

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

modify a particular pattern starting from second line of the search pattern

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

modify a particular pattern starting from second line of the search pattern

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

need a cmd to search starting word

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

perl search and replace - search in first line and replance in 2nd line

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

How to print line starting with certain string together with its following line?

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

With script bash, read file line per line starting at the end

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

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

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

Search for words starting and ending with

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

Remove new line starting with a numeric value and append it to the previous line

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
ALTER TEXT SEARCH 
DICTIONARY(7) SQL Commands ALTER TEXT SEARCH DICTIONARY(7) NAME
ALTER TEXT SEARCH DICTIONARY - change the definition of a text search dictionary SYNOPSIS
ALTER TEXT SEARCH DICTIONARY name ( option [ = value ] [, ... ] ) ALTER TEXT SEARCH DICTIONARY name RENAME TO newname ALTER TEXT SEARCH DICTIONARY name OWNER TO newowner DESCRIPTION
ALTER TEXT SEARCH DICTIONARY changes the definition of a text search dictionary. You can change the dictionary's template-specific options, or change the dictionary's name or owner. You must be the owner of the dictionary to use ALTER TEXT SEARCH DICTIONARY. PARAMETERS
name The name (optionally schema-qualified) of an existing text search dictionary. option The name of a template-specific option to be set for this dictionary. value The new value to use for a template-specific option. If the equal sign and value are omitted, then any previous setting for the option is removed from the dictionary, allowing the default to be used. newname The new name of the text search dictionary. newowner The new owner of the text search dictionary. Template-specific options can appear in any order. EXAMPLES
The following example command changes the stopword list for a Snowball-based dictionary. Other parameters remain unchanged. ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian ); The following example command changes the language option to dutch, and removes the stopword option entirely. ALTER TEXT SEARCH DICTIONARY my_dict ( language = dutch, StopWords ); The following example command ``updates'' the dictionary's definition without actually changing anything. ALTER TEXT SEARCH DICTIONARY my_dict ( dummy ); (The reason this works is that the option removal code doesn't complain if there is no such option.) This trick is useful when changing configuration files for the dictionary: the ALTER will force existing database sessions to re-read the configuration files, which otherwise they would never do if they had read them earlier. COMPATIBILITY
There is no ALTER TEXT SEARCH DICTIONARY statement in the SQL standard. SEE ALSO
CREATE TEXT SEARCH DICTIONARY [create_text_search_dictionary(7)], DROP TEXT SEARCH DICTIONARY [drop_text_search_dictionary(7)] SQL - Language Statements 2010-05-14 ALTER TEXT SEARCH DICTIONARY(7)
All times are GMT -4. The time now is 03:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy