At the first line:
what should it display?
When I try (OK AIX 4.2.1...) I get:
Is that what you want? (I would have expected 111012...)
If its 111012 then why not simply:
Ah Im using ksh...
Hi gurus
I am not a C programmer but I need to read and write files on a computer on LAN using IP address.
Suppose on a computer that has an IP 192.168.0.2
Any help or code example. I did in JAVA using URL, but do not know how to do in ANSI-C.
In java:
-------
URL url = new... (3 Replies)
Hi All,
Not sure if this would be in a dummies sectiin or advanced. I'm looking for a script if someone has doen something like this.
I have list of files -
adc_earnedpoints.20070630.txt
adc_earnedpoints.20070707.txt
adc_earnedpoints.20070714.txt
adc_earnedpoints.20070721.txt... (1 Reply)
Hi my prob statement is to create a new file or to append to the 1tst file the followign chages.
File 1: txt file.
portfolio No a b c d
abc 1 Any Any Any charString
cds 2 values values values charString
efd 3 can can can charString
fdg 4 come come come charString... (4 Replies)
Hi all,
I have the following shell script code which tries to sftp and writes the log into the log file.
TestConnection ()
{
echo 'Connection to ' $DESTUSERNAME@$DESTHOSTNAME
$SETDEBUG
if ]; then rm $SCRIPT ; fi
touch $SCRIPT
echo "cd" $REMOTEDIR >> $SCRIPT
echo "quit" >>... (10 Replies)
Hello everybody,
I'm trying to code a program which makes the following:
It sends an ARP request frame and when it gets the reply, extracts the IP address of source and writes it to a .txt file. This is gonna be done with many hosts (with a for() loop), so, the text file would look like... (2 Replies)
Hi All,
Please help me in writing data to a file in one row.
In database there is a column which contains large data which does not fit in the file in one row. The column contains list of paths. I want to write these paths to a file in one row.
Please find the code below writes :
... (2 Replies)
Hi,
I am new to shell programming and need help. I have File1 with some ID numbers and File2 with ID number and some associated information.
I want to match the ID numbers from File1 to contents in File2 and output a third file which pulls out the ID numbers and the associated information with... (2 Replies)
Need to develop a unix shell script for the below requirement and I need your assistance:
1) search for file.log and file.bad file in a directory and read them
2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file
4) concatinate each row from bad file as... (3 Replies)
Hi All,
Here is my requirement. I am grepping through the log files and cutting some fields from the file to generate a csv file. Now I have to check if 2nd field is having some fixed value then with the help of 4th field I have to look in same log and run another grep command to retrieve the... (11 Replies)
Dear All,
I am reading one XML file to extract value from the particular tag:-
Sample xml is below:-
<KeyValuePairs>
<Key>TestString</Key>
<Value>Test12_Pollings</Value>
</KeyValuePairs>
I want to read the value for the KEY tag and there will be multiple key tags :-
awk... (4 Replies)
Discussion started by: sharsour
4 Replies
LEARN ABOUT PHP
str_word_count
STR_WORD_COUNT(3) 1 STR_WORD_COUNT(3)str_word_count - Return information about words used in a stringSYNOPSIS
mixed str_word_count (string $string, [int $format], [string $charlist])
DESCRIPTION
Counts the number of words inside $string. If the optional $format is not specified, then the return value will be an integer representing
the number of words found. In the event the $format is specified, the return value will be an array, content of which is dependent on the
$format. The possible value for the $format and the resultant outputs are listed below.
For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain,
but not start with "'" and "-" characters.
PARAMETERS
o $string
- The string
o $format
- Specify the return value of this function. The current supported values are:
o 0 - returns the number of words found
o 1 - returns an array containing all the words found inside the $string
o 2 - returns an associative array, where the key is the numeric position of the word inside the $string and the value is the
actual word itself
o $charlist
- A list of additional characters which will be considered as 'word'
RETURN VALUES
Returns an array or an integer, depending on the $format chosen.
CHANGELOG
+--------+--------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+--------------------------------+
| 5.1.0 | |
| | |
| | Added the $charlist parameter |
| | |
+--------+--------------------------------+
EXAMPLES
Example #1
A str_word_count(3) example
<?php
$str = "Hello fri3nd, you're
looking good today!";
print_r(str_word_count($str, 1));
print_r(str_word_count($str, 2));
print_r(str_word_count($str, 1, 'aaac3'));
echo str_word_count($str);
?>
The above example will output:
Array
(
[0] => Hello
[1] => fri
[2] => nd
[3] => you're
[4] => looking
[5] => good
[6] => today
)
Array
(
[0] => Hello
[6] => fri
[10] => nd
[14] => you're
[29] => looking
[46] => good
[51] => today
)
Array
(
[0] => Hello
[1] => fri3nd
[2] => you're
[3] => looking
[4] => good
[5] => today
)
7
SEE ALSO explode(3), preg_split(3), split(3), count_chars(3), substr_count(3).
PHP Documentation Group STR_WORD_COUNT(3)