in other words i want choose what print out.
I was thinking to use fscanf as:
but in this way i get:
1 2 3
Is there a solution using fscanf to obtain my purpose?
Thanks
D
---------- Post updated at 11:08 AM ---------- Previous update was at 10:51 AM ----------
hi
I solved it. it enough to insert a format type indicator, something like:
Hi All,
Please help me in creating files through K-shell scripts.
I am having one file in this format.
OWNER.TABLE_NAME
OWNER.TABLE_NAME1
OWNER1.TABLE_NAME
OWNER1.TABLE_NAME1
I want to read the above file and create new file through k shell script.
The new file should looks like this.... (4 Replies)
How can i read all the unique words in a file, i used -
cat comment_file.txt | /usr/xpg6/bin/tr -sc 'A-Za-z' '/012'
and
cat comment_file.txt | /usr/xpg6/bin/tr -sdc 'A-Za-z' '/012'
but they didnt worked..... (5 Replies)
Hi,
i need a script to find words "error,jbase,voilation,segmentation" from a file(verify.txt) and if got any of the above words then send an email and if wont find any then execute the cron job. every time it read file verify.txt it must first clear the previous data in the file .
Kindly... (3 Replies)
hi,
I am a begginer in unix and i want to know how to open a file and read it and separate the numbers & words and storing it in separate files, Using shell scripting.
Please help me out for this.
Regards
S.Kamakshi (2 Replies)
I use fopen, fscanf, fclose to read a file. It can work well. since many files should be read, a function is created with the same code. But in the function, fscanf can not work well.
for example, the first line of the the file is: > filename
but the fscanf will give: 207/23/eee/34
it appears... (2 Replies)
Hello,
I have a complex problem. I have a file in which words have been joined together:
Theboy ranslowly
I want to be able to correctly split the words using a lookup file in which all the words occur:
the
boy
ran
slowly
slow
put
child
ly
The lookup file which is meant for look up... (21 Replies)
Dear all,
I am working with names and I have a large file of names in which some words are written together (upto 4 or 5) and their corresponding single forms are also present in the word-list.
An example would make this clear
annamarie
mariechristine
johnsmith
johnjoseph smith
john
smith... (8 Replies)
Hello,
I would like to change my setting in a file to the setting that user input.
For example, by default it is
ONBOOT=ON
When user key in "YES", it would be
ONBOOT=YES
--------------
This code only adds in the entire user input, but didn't replace it.
How do i go about... (5 Replies)
hi I made this simple script to extract data and pretty much is a list and would like to extract data of two words separated by commas and I would like to make a new text file that would list these extracted data into a list and each in a new line.
Example that worked for me with text file... (5 Replies)
Hi All,
I need one help to replace particular words in file based on if finds another words in that file .
i.e.
my self is peter@king.
i am staying at north sydney.
we all are peter@king.
How to replace peter to sham if it finds @king in any line of that file.
Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 Replies
LEARN ABOUT PHP
fscanf
FSCANF(3) 1 FSCANF(3)fscanf - Parses input from a file according to a formatSYNOPSIS
mixed fscanf (resource $handle, string $format, [mixed &$...])
DESCRIPTION
The function fscanf(3) is similar to sscanf(3), but it takes its input from a file associated with $handle and interprets the input
according to the specified $format, which is described in the documentation for sprintf(3).
Any whitespace in the format string matches any whitespace in the input stream. This means that even a tab in the format string can
match a single space character in the input stream.
Each call to fscanf(3) reads one line from the file.
PARAMETERS
o $handle
-A file system pointer resource that is typically created using fopen(3).
o $format
- The specified format as described in the sprintf(3) documentation.
o $...
- The optional assigned values.
RETURN VALUES
If only two parameters were passed to this function, the values parsed will be returned as an array. Otherwise, if optional parameters are
passed, the function will return the number of assigned values. The optional parameters must be passed by reference.
EXAMPLES
Example #1
fscanf(3) Example
<?php
$handle = fopen("users.txt", "r");
while ($userinfo = fscanf($handle, "%s %s %s
")) {
list ($name, $profession, $countrycode) = $userinfo;
//... do something with the values
}
fclose($handle);
?>
Example #2
Contents of users.txt
javier argonaut pe
hiroshi sculptor jp
robert slacker us
luigi florist it
SEE ALSO fread(3), fgets(3), fgetss(3), sscanf(3), printf(3), sprintf(3).
PHP Documentation Group FSCANF(3)