Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to search unique occurence in a file? Post 302358939 by akash028 on Monday 5th of October 2009 08:42:26 AM
Old 10-05-2009
It works. Thanks a lot. Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

search& count for the occurence of a word

Greetings, I need to search and count all the occurences of a word in all the files in a directory. Any suggestions greatly appreciated. Thanks (1 Reply)
Discussion started by: skoppana
1 Replies

2. Shell Programming and Scripting

Search for all the unique file extension

Greetings to All ... :b: I have one root folder containing different other folders within it. I need to get the list of all different types of file extensions residing in those folders. Could anyone help me providing some shell script? (1 Reply)
Discussion started by: riverside
1 Replies

3. Shell Programming and Scripting

search file between last occurence of 2 strings

I need to extract the last block of /== START OF SQLPLUS ==/ and /== END OF SQLPLUS ==/. The logifle is written to several times in a day using >> to append. I need a solution using grep/sed. logfile looks like this START OF LOGFILE /== START OF SQLPLUS ==/ ERROR /== END OF SQLPLUS... (5 Replies)
Discussion started by: hanton
5 Replies

4. Shell Programming and Scripting

Perl : Search for next occurence of a word in an array

I have an array as follows: Space: ABC Name: def Age: 22 Type: new Name: fgh Age: 34 Type: old Space: XYZ Name: pqr Age: 44 Type: new : : How can I separate the array with elements starting from Space:ABC until Space: XYZ & put them in a different array & so on... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

5. Shell Programming and Scripting

How to identify the occurence of a pattern between a unique character?

hi, is it possible to find the number of occurences of a pattern between two paranthesis. for e.g i have a file as below. >>{ >>hi >>GoodMorning >>how are you? >>} >>is it good, >>tell me yes, if it is good In the above file, its clear the occurence of word "Good"... (17 Replies)
Discussion started by: divak
17 Replies

6. Shell Programming and Scripting

Search file for pattern2 starting from occurence of pattern1

Hi folks, I have a file which contains several occurences of 2 different patterns. I need to find out the line of first occurence of pattern2 starting after the position of first occurence of pattern1. example file: aaaa pattern2 bbbb pattern1 ccc pattern2 ddd pattern1 eee pattern2... (9 Replies)
Discussion started by: sameucho
9 Replies

7. UNIX for Dummies Questions & Answers

Search specific pattern in file and return number of occurence

Hi I want to search for a specific pattern in file Say ABC;HELLO_UNIX_WORLD;PQR ABC;HELLO_UNIX_WORLD_IS_NOT_ENOUGH;XYZ ABC;HELLO_UNIX_FORUM;LMN Pattern to search is : "HELLO_UNIX_*****" and not "HELLO_UNIX_***_***_" I mean after "HELLO_UNIX" there can only be one word.In this case... (2 Replies)
Discussion started by: dashing201
2 Replies

8. UNIX for Dummies Questions & Answers

To find the Nth Occurence of Search String

Hi guys, I like to find the Line number of Nth Occurence of a Search string in a file. If possible, if it will land the cursor to that particualar line will be great. Cheers!! (3 Replies)
Discussion started by: mac4rfree
3 Replies

9. Shell Programming and Scripting

Search only the first occurence in shell

Hello I have a configuration file and I want to extract a part of this configuration. Example of configuration: profile toto { bla bla blabla } conftest { toto { myarguements } I try to do a sed command: sed -n '/'toto' {$/,/^}/p' But the result is : profile toto { (6 Replies)
Discussion started by: maverick31
6 Replies

10. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
INSTR(3)						       MBK UTILITY FUNCTIONS							  INSTR(3)

NAME
instr - find an occurence of a string in a string, starting at a specified character. ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr SYNOPSYS
#include "mut.h" char *instr(s, find, from) char *s, *find, from; PARAMETERS
s Pointer to the string to be searched for the pattern find Pointer to the string to be found, the pattern from Character to be searched backwards before searching for the pattern DESCRIPTION
instr searches the first occurence of the string find in the string s, starting its search at the last occurence of the from character in the string s. If either s or find is NULL, the function returns NULL. If from is (char)0, the pattern is searched from the begining of s. This quite exotic behaviour is useful to search the occurence of a name in a string resulting from a flatten, when only a terminal object name is to be taken into account. RETURN VALUES
instr return NULL either if the pattern find is not present in the searched string s, or if one at least of these two string are NULL. If the pattern is found, a value different from NULL is returned. EXAMPLE
#include "mut.h" /* check for the pattern 'ck' anywhere in the string */ #define contains_ck(name)instr(name, "ck", ' ') /* check for the pattern 'ck' in the signal name, not instance ones */ #define isclock(ptsig) instr(getsigname(ptsig), "ck", SEPAR) SEE ALSO
mbk(1), isvdd(3), isvss(3). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. ASIM
/LIP6 October 1, 1997 INSTR(3)
All times are GMT -4. The time now is 07:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy