Hello,
I am an intermediate scripter. I can usually find and adapt what I need by searching through previous postings, but I'm stumped.
I have a string with the format "{Name1 Release1 Type1 Parent1} {Name2 Release2 Type2 Parent2}". It is being passed as an argument into a ksh script. I need to... (5 Replies)
Hi,
Is there any way to convert a string into an array in KSH? In other words I want to split the string like this:
STRING="one two three four"
into an array of 4 values splitting on white space. The array should be similar to the one that would be created with the following command:
... (3 Replies)
hi ,
I have a String str="/opt/ibm/lotus/ibw/latest" or ="/opt/lotus/ibw/latest" this value is dynamic..I want to split this string into 2 strings
1. /opt/ibm/lotus(/opt/lotus) this string must ends with "lotus"
2./ibw/latest
can any body help me on this?
Regards,
sankar (2 Replies)
My input contains a single word lines.
From each line
data.txt
prjtestBlaBlatestBlaBla
prjthisBlaBlathisBlaBla
prjthatBlaBladpthatBlaBla
prjgoodBlaBladpgoodBlaBla
prjgood1BlaBla123dpgood1BlaBla123
Desired output -->
data_out.txt
prjtestBlaBla
prjthisBlaBla... (8 Replies)
Hi,
can some one please help me to split the file based on groups.
like in the below scenario x indicates the begining of the group and the file should be split each with 2 groups below there are 10 groups it should create 5 files. could you please help? (4 Replies)
Help needed urgently please.
I have a large file - a few hundred thousand lines.
Sample
CP START ACCOUNT
1234556
name 1
CP END ACCOUNT
CP START ACCOUNT
2224444
name 1
CP END ACCOUNT
CP START ACCOUNT
333344444
name 1
CP END ACCOUNT
I need to split this file each time "CP START... (7 Replies)
Hello
What command can i use to split a tab delimited txt file into two files base on the occurrence of a string
my file name is EDIT.txt
The content of file is below
XX 1234 PROCEDURES
XY 1634 PROCEDURES
XM 1245 CODES
XZ 1256 CODES
It has more than a million record
If there is... (16 Replies)
hi ,
The scenario is like this,
i have a large text files (max 5MB , about 5000 file per day ),
Inside almost each line of this file there is a tag 3100.2.22.1 (represent Call_Type) , i need to generate many filess , each one with distinct (3100.2.22.1 Call_Type ) , and one more file to... (3 Replies)
Greetings Experts,
I am generating a validation query through awk and facing an issue, which I need to overcome by splitting the data based on the pattern matching count in the value of an array.
File1 --
Table11@column1@date@Table21@column1@varchar(10)@d;... (4 Replies)
I have a huge file (around 4-5 GB containing 20 million rows) which has text like:
<EOFD>11<EOFD>22<EORD>2<EOFD>2222<EOFD>3333<EORD>3<EOFD>44<EOFD>55<EORD>66<EOFD>888<EOFD>9999<EORD>
Actually above is an extracted file from a Sql Server with each field delimited by <EOFD> and each row ends... (8 Replies)
Discussion started by: amvip
8 Replies
LEARN ABOUT PHP
substr_count
SUBSTR_COUNT(3) 1 SUBSTR_COUNT(3)substr_count - Count the number of substring occurrencesSYNOPSIS
int substr_count (string $haystack, string $needle, [int $offset], [int $length])
DESCRIPTION substr_count(3) returns the number of times the $needle substring occurs in the $haystack string. Please note that $needle is case sensi-
tive.
Note
This function doesn't count overlapped substrings. See the example below!
PARAMETERS
o $haystack
- The string to search in
o $needle
- The substring to search for
o $offset
- The offset where to start counting
o $length
- The maximum length after the specified offset to search for the substring. It outputs a warning if the offset plus the length is
greater than the $haystack length.
RETURN VALUES
This function returns an integer.
CHANGELOG
+--------+-----------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+-----------------------------------------------+
| 5.1.0 | |
| | |
| | Added the $offset and the $length parameters |
| | |
+--------+-----------------------------------------------+
EXAMPLES
Example #1
A substr_count(3) example
<?php
$text = 'This is a test';
echo strlen($text); // 14
echo substr_count($text, 'is'); // 2
// the string is reduced to 's is a test', so it prints 1
echo substr_count($text, 'is', 3);
// the text is reduced to 's i', so it prints 0
echo substr_count($text, 'is', 3, 3);
// generates a warning because 5+10 > 14
echo substr_count($text, 'is', 5, 10);
// prints only 1, because it doesn't count overlapped substrings
$text2 = 'gcdgcdgcd';
echo substr_count($text2, 'gcdgcd');
?>
SEE ALSO count_chars(3), strpos(3), substr(3), strstr(3).
PHP Documentation Group SUBSTR_COUNT(3)