Sponsored Content
Top Forums UNIX for Dummies Questions & Answers To find the Nth Occurence of Search String Post 302541935 by yazu on Tuesday 26th of July 2011 07:52:37 AM
Old 07-26-2011
GNU grep:
Code:
vim +`grep  -n -mN PATTERN INPUTFILE | tail -n1 | cut -c1` INPUTFILE

Of course you can put this in a script with N, PATTERN, and INPUTFILE as parameters.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find vowel's occurence in a string

Hi All, I want to search the string for vowel's occurence and find the no of occurence of each vowels, Could anyone help me out? This is urgent to me...I m new to Shell programming.. Thanks and Regards, Nids:b: (4 Replies)
Discussion started by: Nidhi2177
4 Replies

2. Shell Programming and Scripting

Find index of last occurence of a character within a string

I need to find the index of last '|' (highlighted in bold) in awk : |ifOraDatabase.Lastservererr<>0then|iferr_flag<>0then|end if Please suggest a way... Thanks (5 Replies)
Discussion started by: joyan321
5 Replies

3. Shell Programming and Scripting

shell script to find the second occurence of the alphabet in a string

this is my assignment question. i'm supposed to submit it tommorow. can somebody please help me with it? Do not post homework questions in the main forums. Please post in the homework forum using the correct template. (0 Replies)
Discussion started by: vijjy
0 Replies

4. Shell Programming and Scripting

Find the occurence of particular string in log file

I have a log file which looks like this: <845185415165:STATUS:5/0:0:0:0:0|ghy59DI5zasldf87asdfamas8df9asd903tGUVSQx4GJVSQ==> I have to extract DATE and number of times the keyword STATUS is shown on each date. Input is : <1354625655744:STATUS:5/0:0:0:0:0|ghy59DI5ztGUVSQx4GJVSQ==>... (8 Replies)
Discussion started by: maddyrox
8 Replies

5. Shell Programming and Scripting

[Solved] Find and replace till nth occurence of a special character

Hi, I have a requirement to search for a pattern in each line in a file and remove the in between words till the 3rd occurrence of double quote ("). Ex: CREATE TABLE "SCHEMANAME"."AMS_LTV_STATUS" (Note: "SCHEMANAME" may changes for different schemas. Its not a fixed value) I need to... (2 Replies)
Discussion started by: satyaatcgi
2 Replies

6. Shell Programming and Scripting

To find nth position of character in string

Hi guyz i want to know nth position of character in string. For ex. var="UK,TK,HK,IND,AUS" now if we see 1st occurance of , is at 3 position, 2nd at 6,..4th at 13 position. 1st position we can find through INDEX, but what about 2nd,3rd and 4th or may be upto nth position. ? In oracle we had... (2 Replies)
Discussion started by: Jonty Immortal
2 Replies

7. Shell Programming and Scripting

Find and increment at each occurence of string (loop)

I created script (sh shell) to generate vlc playlist based on some data files. All works fine so far except one string I do not know how to handle with. VLCSTART='<vlc:id>' VLCV=0 VLCEND='</vlc:id>' echo -e $'\n'$'\t'$'\t'$'\t'$'\t'\$VLCSTART$VLCV$VLCENDOutput file contains several occurences... (10 Replies)
Discussion started by: TiedCone
10 Replies

8. Shell Programming and Scripting

Get nth occurence of string from a file

I have file in which the data looks like this, 01,0000000,xxxxxxx/ 02,xxxxxxxx,yyyyyy/ 03,test1,41203016,,/ 01,0000000,xxxxxxx/ 02,xxxxxxxx,yyyyyy/ ... (16 Replies)
Discussion started by: r@v!7*7@
16 Replies

9. Shell Programming and Scripting

How to search and replace string from nth column from a file?

I wanted to search for a string and replace it with other string from nth column of a file which is comma seperated which I am able to do with below # For Comma seperated file without quotes awk 'BEGIN{OFS=FS=","}$"'"$ColumnNo"'"=="'"$PPK"'"{$"'"$ColumnNo"'"="'"$NPK"'"}{print}' ${FileName} ... (5 Replies)
Discussion started by: Amit Joshi
5 Replies

10. Shell Programming and Scripting

Delete after nth occurence of string in each line

Hello, Environment: I am under Ubuntu 18.04 bionic. I have an sql file consisting of 10K lines. Objective: What I am trying to attain is to remove everything coming after 2nd tab in each line. While searching for the answer, I found two answers and both gave expected result just for the first... (2 Replies)
Discussion started by: baris35
2 Replies
WWW::Search::Lycos(3pm) 				User Contributed Perl Documentation				   WWW::Search::Lycos(3pm)

NAME
WWW::Search::Lycos - class for searching www.lycos.com SYNOPSIS
use WWW::Search; my $oSearch = new WWW::Search('Lycos'); my $sQuery = WWW::Search::escape_query("+sushi restaurant +Columbus Ohio"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, " "; } DESCRIPTION
This class is a Lycos specialization of WWW::Search. It handles making and interpreting Lycos-site searches http://www.lycos.com. This class exports no public interface; all interaction should be done through WWW::Search objects. NOTES
Warning! As of 2004-01, lycos.com often returns an error page in place of the third page of results. So it is very difficult to get more than 20 hits for any query! www.lycos.com is sometimes slow to respond; but I have not had a problem with the default timeout. www.lycos.com does not give the date nor size of the pages at the resulting URLs; therefore change_date() and size() will never have a value. SEE ALSO
To make new back-ends, see WWW::Search. BUGS
Please tell the author if you find any! AUTHOR
As of 1998-12-07, "WWW::Search::Lycos" is maintained by Martin Thurn (mthurn@cpan.org). "WWW::Search::Lycos" was originally written by Martin Thurn, based on "WWW::Search::Yahoo" version 1.12 of 1998-10-22. LEGALESE
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. perl v5.12.4 2011-11-02 WWW::Search::Lycos(3pm)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy