Sponsored Content
Top Forums Shell Programming and Scripting Counting string of a variable Post 302249773 by Dip on Wednesday 22nd of October 2008 05:06:03 AM
Old 10-22-2008
Counting string of a variable

Hi,

There is a variable f_name, it store some file names.
Value of f_name=a.sql b.sql c.sql.......
like this.

want to count how many file name the var f_name stores.
Without using loop is there any command to count that.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting patterns in a shell string

Hello, I am writing a shell script and I need to find a way to count the number of whitespaces in a string. Eg: NAME="Bob Hope" I am looking for a way to count the number of whitespaces in this string. So a command that would take this string and return 1. Or take "First Middle Last"... (3 Replies)
Discussion started by: kevin80
3 Replies

2. Shell Programming and Scripting

Counting the max length of string

Hi all, I have a flat file of 1000 rows. I want to check the length of the 5th column. The one having the longest length , I want to set it as DEFINED PARAMETER. So later I can check others with that particular number only. Any ideas ?? (2 Replies)
Discussion started by: ganesh123
2 Replies

3. Shell Programming and Scripting

Counting up a variable

Hello, I am trying to write a shell script, but i encountered a problem I cant solve alone so I hope you guys can help me. The situation is: I have a script file and a config file, in my config file I set some Variables: for example: destination=(xp, xq, xt) username=testor... (3 Replies)
Discussion started by: Kenada
3 Replies

4. Shell Programming and Scripting

need help with counting of files then pass number to variable

hi all, i'm trying to pass a count of files to a variable thru these set of codes: sh_count=$(ls -1 fnd_upload_LV*.* |wc -l) problem is if no files matches that, it will give an error "ls: fnd_upload_LV*.*: No such file or directory". how do i avoid having the shell script show that... (2 Replies)
Discussion started by: adshocker
2 Replies

5. UNIX for Dummies Questions & Answers

grep -c script counting string twice instead of once?

I tried this script to get a count of the occurrence of a string in files. I have multiple files in one directory I will use this on. All the filenames begin "invALL.06" The script works, except it counts twice for every one instance of 'Invoice Total'. If there are 5 occurences of 'Invoice... (2 Replies)
Discussion started by: scarletsupra
2 Replies

6. Shell Programming and Scripting

Counting number of commas(,) in a variable

Hi all, I am having problems counting commas (,) from a variable in shell scripting.. the variable contains similiar to: ID@NAME@DESCRIPTION,ID@NAME@DESCRIPTION, ..... It can go on and on.. So i need to count the number of sets i.e.( ID@NAME@DESCRIPTION is one set) and process the... (4 Replies)
Discussion started by: faelric
4 Replies

7. UNIX for Dummies Questions & Answers

Help with counting string elements

Hi All, I hv several files which have hundreds of lines each for example>XYZ.abc01 NNNTCGGTNNNNNCCACACACMYACACACCCACACCCACSCARCAC I'd like to exculde the first line beginning with ">" and then for the rest of the lines get a count for each string element. So for the above example I would like... (8 Replies)
Discussion started by: pawannoel
8 Replies

8. UNIX for Dummies Questions & Answers

counting occurrence of characters in a string

Hello, I have a string like this 0:1:2:0:2:2:4:0:0:0:-200:500...... what i want is to break down how many different characters are there and their count. For example for above string it should display 0 - 5 times 1 - 1 times 2 - 3 times 4 - 1 times . . . I am stuck in writing... (8 Replies)
Discussion started by: exit86
8 Replies

9. Shell Programming and Scripting

Counting Instances of a String with AWK

I have a list of URLs and I want to be able to count the number of instances of addresses ending in a certain TLD and output and sort it like so. 5 bdcc.com 48 zrtzr.com 49 rvo.com Input is as so ync.org sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu... (1 Reply)
Discussion started by: Pjstaab
1 Replies

10. Shell Programming and Scripting

Counting a string between 2 strings...

I have been working on this for a little while and have been unable to come to a solution. Any help would be appreciated. I am working on a UNIX workstation and have a 30-40 meg text file that I am working with. In my real file there is hundreds of Jobs. Example of input file; misc logging data... (1 Reply)
Discussion started by: ny_evan
1 Replies
CUBRID_FETCH_OBJECT(3)							 1						    CUBRID_FETCH_OBJECT(3)

cubrid_fetch_object - Fetche the next row and returns it as an object

SYNOPSIS
object cubrid_fetch_object (resource $result, [string $class_name], [array $params], [int $type]) DESCRIPTION
This function returns an object with the column names of the result set as properties. The values of these properties are extracted from the current row of the result. PARAMETERS
o $result -$result comes from a call to cubrid_execute(3) o $class_name - The name of the class to instantiate. If not specified, a stdClass (stdClass is PHP's generic empty class that's used when cast- ing other types to objects) object is returned. o $params - An optional array of parameters to pass to the constructor for $class_name objects. o $type - Type can only be CUBRID_LOB, this parameter will be used only when you need to operate the lob object. RETURN VALUES
An object, when process is successful. FALSE, when there are no more rows; NULL, when process is unsuccessful. EXAMPLES
Example #1 cubrid_fetch_object(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb"); $res = cubrid_execute($conn, "SELECT * FROM code"); var_dump(cubrid_fetch_object($res)); // if you want to operate LOB object, you can use cubrid_fetch_object($res, CUBRID_LOB) class demodb_code { public $s_name = null; public $f_name = null; public function toString() { var_dump($this); } } var_dump(cubrid_fetch_object($res, "demodb_code")); // if you want to operate LOB object, you can use cubrid_fetch_object($res, "demodb_code", CUBRID_LOB) class demodb_code_construct extends demodb_code { public function __construct($s, $f) { $this->s_name = $s; $this->f_name = $f; } } var_dump(cubrid_fetch_object($res, 'demodb_code_construct', array('s_name', 'f_name'))); // if you want to operate LOB object, you can use cubrid_fetch_object($res, 'demodb_code_construct', array('s_name', 'f_name'), CUBRID_LOB) var_dump(cubrid_fetch_object($res)); cubrid_close_request($res); cubrid_disconnect($conn); ?> The above example will output: object(stdClass)#1 (2) { ["s_name"]=> string(1) "X" ["f_name"]=> string(5) "Mixed" } object(demodb_code)#1 (2) { ["s_name"]=> string(1) "W" ["f_name"]=> string(5) "Woman" } object(demodb_code_construct)#1 (2) { ["s_name"]=> string(6) "s_name" ["f_name"]=> string(6) "f_name" } object(stdClass)#1 (2) { ["s_name"]=> string(1) "B" ["f_name"]=> string(6) "Bronze" } SEE ALSO
cubrid_execute(3), cubrid_fetch(3), cubrid_fetch_array(3), cubrid_fetch_assoc(3), cubrid_fetch_row(3). PHP Documentation Group CUBRID_FETCH_OBJECT(3)
All times are GMT -4. The time now is 12:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy