I'm trying to grep for 3 patterns in a string of gibberish. It so happens that each line is appended by a date/time stamp and i was able to figure out how to extract only the datetime.
Is there anyway you can grep using multiple wildcards? When I run the below line the results return fine;
grep 12345 /usr/local/production/soccermatchplus/distributor/clients/*/out/fixtures.xml | awk -F/ '{print $8}'
However ideally, I need it to grep for;
grep 12345... (3 Replies)
Guys ..
Need to pull this highlighted strings irrespective of line numbers & should be echoed . But these strings are from Outfile from different dir. In which way this can be grepped ?? Need an idea
http-timeout 120 seconds
persistent-timeout 180 seconds
host-rewriting on
... (7 Replies)
Can someone tell me how I can do this?
e.g:
Say file1.txt contains:
today is monday
the 22 of
NOVEMBER
2010
and file2.txt contains:
the
11th
month
of
How do i replace the word NOVEMBER with (5 Replies)
Would appear to me to be a farily simple question but having search all the threads I can't find the answer .. I just want sed to output the single line in a file that contains two string anywhere on the line..
e.g. currently using this command
sed -n -e'/str1/p' -e '/str2/p' < file
and... (3 Replies)
Hi,
I have a requirement with,
No~Dt~Notes
1~2011/08/1~"aaa
bbb
ccc
ddd
eee
fff
ggg
hhh"
Single column alone got splitted into multiple lines.
I require the output as
No~Dt~Notes
1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh"
mean to say those new lines to be... (1 Reply)
Hi,
Can anyone suggest quick way to get desired output?
Sample input file content:
A 12 9
A -0.3 2.3
B 1.0 -4
C 34 1000
C -111 900
C 99 0.09
Output required:
A 12 9 -0.3 2.3
B 1.0 -4
C 34 1000 -111 900 99 0.09
Thanks (3 Replies)
Hi,
I need someone's help in writing correct perl code.
I implemented following code for "multiple search strings replaced with single string".
=========================================================
#!/usr/bin/perl
my $searchStr = 'register_inst\.write_t\(' |... (2 Replies)
Hi,
following Perl code i used for finding multiple strings and replace with single string.
code:
#!/usr/bin/perl
my @files = <*.txt>;
foreach $fileName (@files) {
print "$fileName\n";
my $searchStr = ',rdata\)' | ',,rdata\)' | ', ,rdata\)';
my $replaceStr =... (2 Replies)
Dear Friends,
I have a flat file which is as follows
$cat sample
123,456,1,1,1,1
sdfas,345,1,1,1,1
dfgd,234,2,3,4,1
ggffgr,234,4,3,2,1
jkhu,354.1,1,1,1
$
I want to get output of only those lines which has '1' in 3 to 5 position.
So I want output as follows
123,456,1,1,1,1... (8 Replies)
I need to grep multiple strings from a particular file.
I found the use of egrep "String1|String2|String3" file.txt | wc-l
Now what I'm really after is that I need to separate word count per each string found. I am trying to keep it to use the grep only 1 time.
Can you guys help ?
... (9 Replies)
Discussion started by: nms
9 Replies
LEARN ABOUT OSX
strtok_r
STRTOK(3) BSD Library Functions Manual STRTOK(3)NAME
strtok, strtok_r -- string tokens
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <string.h>
char *
strtok(char *restrict str, const char *restrict sep);
char *
strtok_r(char *restrict str, const char *restrict sep, char **restrict lasts);
DESCRIPTION
This interface is obsoleted by strsep(3).
The strtok() function is used to isolate sequential tokens in a null-terminated string, str. These tokens are separated in the string by at
least one of the characters in sep. The first time that strtok() is called, str should be specified; subsequent calls, wishing to obtain
further tokens from the same string, should pass a null pointer instead. The separator string, sep, must be supplied each time, and may
change between calls.
The implementation will behave as if no library function calls strtok().
The strtok_r() function is a reentrant version of strtok(). The context pointer last must be provided on each call. The strtok_r() function
may also be used to nest two parsing loops within one another, as long as separate context pointers are used.
The strtok() and strtok_r() functions return a pointer to the beginning of each subsequent token in the string, after replacing the token
itself with a NUL character. When no more tokens remain, a null pointer is returned.
EXAMPLES
The following uses strtok_r() to parse two strings using separate contexts:
char test[80], blah[80];
char *sep = "\/:;=-";
char *word, *phrase, *brkt, *brkb;
strcpy(test, "This;is.a:test:of=the/string\tokenizer-function.");
for (word = strtok_r(test, sep, &brkt);
word;
word = strtok_r(NULL, sep, &brkt))
{
strcpy(blah, "blah:blat:blab:blag");
for (phrase = strtok_r(blah, sep, &brkb);
phrase;
phrase = strtok_r(NULL, sep, &brkb))
{
printf("So far we're at %s:%s
", word, phrase);
}
}
SEE ALSO memchr(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), wcstok(3)STANDARDS
The strtok() function conforms to ISO/IEC 9899:1990 (``ISO C90'').
BUGS
The System V strtok(), if handed a string containing only delimiter characters, will not alter the next starting point, so that a call to
strtok() with a different (or empty) delimiter string may return a non-NULL value. Since this implementation always alters the next starting
point, such a sequence of calls would always return NULL.
AUTHORS
Wes Peters, Softweyr LLC: <wes@softweyr.com>
Based on the FreeBSD 3.0 implementation.
BSD November 27, 1998 BSD