You can do something like that with sed :
Jean-Pierre.
Aigles, could you please check your solution?
The OP is asking for:
Quote:
...I want to search for a particular string in each line of that file only if it
occurs only once in the line.
That is same string may be present more than once in a line but I want
it to be greped only when it occurs just once.
Depending upon the occurence of string 'xyz', I want to remove -t from the input file.
There is not a fixed length input file.
Any suggestions
Input file:
this is xyz line -t of the data
this is line 2 of -t of the data
xyz this is line 3 of -t the file
this is line xyz of the -t file... (1 Reply)
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)
I am using awk command for greping an value from the file
the file contains ..
file
----------------------------
content-----------
--------
String main = "81507066666";
------------------------------
i am greping the above value using awk command
NumberToReplace=`cat "file" | grep... (1 Reply)
Hello,
I have active log file i want to grep the last occurrence of the word in that log file the log file gets on increasing and increasing i want to fetch it from live file.
Please guide me, Thanks in advance (4 Replies)
Hi,
I'm a newbie to shell scripting and have searched the forum but couldn't find what i was looking for.
Basically I have a list of filenames like...
123-fileone.txt
I want to be able to extract the prefix up to the first '-'. So I'd end up with 123. I have attempted it using a pretty... (2 Replies)
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)
Hi Everyone,
I am looking for the unix command by which I can view 10 lines after the 1st occurence of a string (including the 1st occurence)
Example : I have the following lines in a unix file. I have to look for the 1st occurence of the string "How are you" and then view the next 10 lines... (3 Replies)
Hi Everyone,
I am looking for the unix command by which I can view 5 lines after the last occurence of a string (including the last occurence)
Example : I have the following lines in a unix file. I have to look for the last occurence of the string "How are you" and then view the next 5... (5 Replies)
Hi Folks,
I am searching something in multiple logs , actually an even ocuurs which get recorded in logs with a special word so rite now I am opening an individual log in vi and then searching it but total in the directory there are such 15 logs and it is very difficult to go one by one so... (1 Reply)
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
LEARN ABOUT LINUX
instr
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)