Sponsored Content
Top Forums Shell Programming and Scripting Cat writing only one record in the output file Post 302767947 by Scrutinizer on Thursday 7th of February 2013 07:37:56 PM
Old 02-07-2013
Hi, there is $rowcount vs $rcnt and $nfnam vs. $newfilename
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Writing given value into a file in particular record and column

Hi All, Could you ppl plz help me in writing into a file , plz find the example below. Ex: Name1|092387|Address1 Name2||Address2 After executing command/script the file should look like Name1|092387|Address1 Name2|+91900236|Address2 plz let me know of you have some solution... (4 Replies)
Discussion started by: shreekrishnagd
4 Replies

2. Shell Programming and Scripting

cat file and parse output

Hello, I'm new to shell scripting and did a search on the forum to what I want to do but couldn't find anything. I have about 9 routers that outputs to 1 syslog file daily named cisco.year.mo.date.log ex: cisco.2009.05.11.log My goal is to make a parsing script that cats today's syslog... (2 Replies)
Discussion started by: jjrambar
2 Replies

3. Shell Programming and Scripting

writing the output of SQL into one file

Hi All, Please help me writing the below script. I have two sql queries. 1. Select count(1),Client_id from TABLE_A group by Client_id; 2. Select count(1),Client_id from TABLE_B group by Client_id; I need the output of above two sql queries in a single file. The output 2nd query should be... (4 Replies)
Discussion started by: 46019
4 Replies

4. UNIX for Dummies Questions & Answers

Cat command drops lines in output file

I use the cat command to concatenate text files, but one of the rows I was expecting doesn't display in the output file. Is there a verbose mode\logging mechanism for the cat command to help me investigate where the lines I was expecting are going?? cat 7760-001_1_*_06_*.txt | grep -v... (1 Reply)
Discussion started by: Xin Xin
1 Replies

5. Shell Programming and Scripting

Getting output from a file similar to cat output

I have a file # cat /root/llll 11 22 33 44 When I cat this file content to a variable inside a shell script and echo that shell script, it does not show up as separate lines. I need echo output similar to cat. cat /root/shell_script.sh #!/bin/bash var=`cat /root/llll` echo $var (2 Replies)
Discussion started by: anil510
2 Replies

6. UNIX for Dummies Questions & Answers

Cat Input & Output to a Log file

Team, we use below command to store the contents in a logfile. cat a.txt > a.log a.txt content is 123 345 Is there any options available to store the command used also? for eg a.log may show as cat a.txt 123 345 (5 Replies)
Discussion started by: sid2013
5 Replies

7. Shell Programming and Scripting

Writing output to a file in columns

Hi I am trying to write output to a file in columns I have file in the follwoing: # cat file abc def # I am trying to write next output as like # cat file abc 123 def 345 # :mad: (6 Replies)
Discussion started by: Priya Amaresh
6 Replies

8. Shell Programming and Scripting

Getting output with sed without writing to a file

HI I am trying to grep 3 characters from hostname and append a character at the end. I tried as in the following: root@abag3:~# hostname | cut -c1-3 hyu Now I am trying to append "g" at the end of this output as in the following. root@abag3:~# hostname | cut -c1-3 | sed -s... (4 Replies)
Discussion started by: Priya Amaresh
4 Replies

9. Shell Programming and Scripting

Ssh cat file output into a file on local computer

Hello, I'm on a remote computer by SSH. How can I get the output of "cat file" into a file on the local computer? I cannot use scp, because it's blocked. something like: ssh root@remote_maschine "cat /file" > /locale_machine/file :rolleyes: (2 Replies)
Discussion started by: borsti007
2 Replies

10. Shell Programming and Scripting

Wrong output when writing to file

Hello, I am having problem while redirecting output to a file where as on console output is proper. for dir in */; do printf "%s, " "$dir"; ls -m "$dir"; echo; done > output.txt Output of above command is coming in single line but when i am redirecting output to a file, single line i... (10 Replies)
Discussion started by: Manoj Rajput
10 Replies
COM(3)									 1								    COM(3)

The COM class

DESCRIPTION
The COM class allows you to instantiate an OLE compatible COM object and call its methods and access its properties. $obj = new COM("Application.ID") METHODS
COM::COM (string $module_name, [mixed $server_name], [int $codepage], [string $typelib]) COM class constructor. The parameters have the following meanings: o module_name - Can be a ProgID, Class ID or Moniker that names the component to load. A ProgID is typically the application or DLL name, fol- lowed by a period, followed by the object name. e.g: Word.Application. A Class ID is the UUID that uniquely identifies a given class. A Moniker is a special form of naming, similar in concept to a URL scheme, that identifies a resource and specifies how it should be loaded. As an example, you could load up Word and get an object representing a word document by specifying the full path to the word document as the module name, or you can use LDAP: as a moniker to use the ADSI interface to LDAP. o server_name - The name of the DCOM server on which the component should be loaded and run. If NULL, the object is run using the default for the application. The default is typically to run it on the local machine, although the administrator might have configured the application to launch on a different machine. If you specify a non- NULL value for server, PHP will refuse to load the object unless the "" configuration option is set to TRUE. If $server_name is an array, it should contain the following elements (case sensitive!). Note that they are all optional (although you need to specify both Username and Password together); if you omit the Server setting, the default server will be used (as mentioned above), and the instantiation of the object will not be affected by the "" directive. DCOM server name +-----------------+--------------------------------------+---+ |$server_name key | | | | | | | | | type | | | | | | | | description | | | | | | +-----------------+--------------------------------------+---+ | Server | | | | | | | | | string | | | | | | | | The name of the server. | | | | | | | Username | | | | | | | | | string | | | | | | | | The username to connect as. | | | | | | | Password | | | | | | | | | string | | | | | | | | The password for $Username. | | | | | | | Flags | | | | | | | | | integer | | | | | | | | One or more of the following con- | | | | stants, logically OR'd together: | | | | CLSCTX_INPROC_SERVER, | | | | CLSCTX_INPROC_HANDLER, | | | | CLSCTX_LOCAL_SERVER, | | | | CLSCTX_REMOTE_SERVER, CLSCTX_SERVER | | | | and CLSCTX_ALL. The default value if | | | | not specified here is CLSCTX_SERVER | | | | if you also omit $Server, or | | | | CLSCTX_REMOTE_SERVER if you do spec- | | | | ify a server. You should consult the | | | | Microsoft documentation for CoCre- | | | | ateInstance for more information on | | | | the meaning of these constants; you | | | | will typically never have to use | | | | them. | | | | | | +-----------------+--------------------------------------+---+ o codepage - Specifies the codepage that is used to convert strings to unicode-strings and vice versa. The conversion is applied whenever a PHP string is passed as a parameter or returned from a method of this COM object. The code page is sticky in PHP 5, which means that it will propagate to objects and variants returned from the object. Possible values are CP_ACP (use system default ANSI code page - the default if this parameter is omitted), CP_MACCP, CP_OEMCP, CP_SYMBOL, CP_THREAD_ACP (use codepage/locale set for the current executing thread), CP_UTF7 and CP_UTF8. You may also use the number for a given codepage; consult the Microsoft documenta- tion for more details on codepages and their numeric values. OVERLOADED METHODS
The returned object is an overloaded object, which means that PHP does not see any fixed methods as it does with regular classes; instead, any property or method accesses are passed through to COM. Starting with PHP 5, PHP will automatically detect methods that accept parameters by reference, and will automatically convert regular PHP variables to a form that can be passed by reference. This means that you can call the method very naturally; you needn't go to any extra effort in your code. In PHP 4, to pass parameters by reference you need to create an instance of the "VARIANT" class to wrap the byref parameters. PSEUDO METHODS
In PHP versions prior to 5, a number of not very pleasant hacks meant that the following method names were not passed through to COM and were handled directly by PHP. PHP 5 eliminates these things; read the details below to determine how to fix your scripts. These magic method names are case insensitive. void COM::AddRef (void ) Artificially adds a reference count to the COM object. Warning You should never need to use this method. It exists as a logical complement to the Release() method below. void COM::Release (void ) Artificially removes a reference count from the COM object. Warning You should never need to use this method. Its existence in PHP is a bug designed to work around a bug that keeps COM objects run- ning longer than they should. PSEUDO METHODS FOR ITERATING
These pseudo methods are only available if com_isenum(3) returns TRUE, in which case, they hide any methods with the same names that might otherwise be provided by the COM object. These methods have all been eliminated in PHP 5, and you should use "For Each" instead. variant COM::All (void ) Returns a variant representing a SafeArray that has 10 elements; each element will be an empty/null variant. This function was supposed to return an array containing all the elements from the iterator, but was never completed. Do not use. variant COM::Next (void ) Returns a variant representing the next element available from the iterator, or FALSE when there are no more elements. variant COM::Prev (void ) Returns a variant representing the previous element available from the iterator, or FALSE when there are no more elements. void COM::Reset (void ) Rewinds the iterator back to the start. COM EXAMPLES
Example #1 COM example (1) <?php // starting word $word = new COM("word.application") or die("Unable to instantiate Word"); echo "Loaded Word, version {$word->Version} "; //bring it to front $word->Visible = 1; //open an empty document $word->Documents->Add(); //do some weird stuff $word->Selection->TypeText("This is a test..."); $word->Documents[1]->SaveAs("Useless test.doc"); //closing word $word->Quit(); //free the object $word = null; ?> Example #2 COM example (2) <?php $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); $conn->Open("Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=database; User ID=user; Password=password"); $rs = $conn->Execute("SELECT * FROM sometable"); // Recordset $num_columns = $rs->Fields->Count(); echo $num_columns . " "; for ($i=0; $i < $num_columns; $i++) { $fld[$i] = $rs->Fields($i); } $rowcount = 0; while (!$rs->EOF) { for ($i=0; $i < $num_columns; $i++) { echo $fld[$i]->value . " "; } echo " "; $rowcount++; // increments rowcount $rs->MoveNext(); } $rs->Close(); $conn->Close(); $rs = null; $conn = null; ?> PHP Documentation Group COM(3)
All times are GMT -4. The time now is 05:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy