As I understand, you would like to sum the third field over the lines having the same first field, and for each distinct first field output a single line with the sum replacing the third field.
Yes, you have to give to awk the name of the input file two times in a row.
Sorry, I don't know what a .xlsx file is. Perhaps a xml file formatted by/for Excel?
Thanks for the reply.
A .xlsx file is a combination of XML architecture and ZIP compression for size reduction. Basically though, I have to output to a spreadsheet.
The other problem is that I have to format the output for each month. I.e:
John Smith, job-title, hours, 01-01-09, 01-15-09
John Smith, job-title, hours, 01-16-09, 01-31-09
Mary Smith job-title, hours, , 01-01-09, 01-31-09
...
John Smith, job-title, hours, 02-01-09, 02-15-09
...
The first two (the total for john Smith for January) have to be added up and displayed separately from John Smith for Feb and separately from Mary Smith.
Hi
I have a CSV file with me in this format
Currency, USD, EUR,
USD, 1.00, 1.32,
EUR, 0.66, 1.00,
How do I transpose the file to get to the format below.
currency, currency, rate
USD, USD, 1.00
USD, EUR, 1.32
EUR, USD, 0.66
EUR, EUR, 1.00
Thanks for your help
We are using... (2 Replies)
HI guys,
I have created a script to read 1 column in a csv file and then place it in text file.
However, when i checked out the text file, it is not in a column format...
Example:
CSV file contains
name,age
aa,11
bb,22
cc,33
After using awk to get first column
TXT file... (1 Reply)
Hi Experts,
Please help me to get the following from script for Unix ENvironment(shell, perl, tr, sed, awk).
INPUT FILE:
20K,ME,592971
20K,YOU,2
20K,HE,1244998
50K,YOU,480110
50K,ME,17
50K,HIS,10
50K,HE,1370391
OUTPUT FILE:
K,ME,YOU,HE,HIS
20K,592971,2,1244998,0... (5 Replies)
So I have a csv file where the 3rd field is a date string in the format yyyy-mm-dd. I need to change it to mm/dd/yyyy. So each line in the csv file looks like:
StringData,StringData,2009-02-17,12.345,StringData
StringData,StringData,2009-02-16,65.789,StringData
Any idea how I can keep... (5 Replies)
Hi All,
I have a file with content
FLIGHT PLANS PRODUCED ON 26.08.2008(SORTED BY FPLAN NUMBER) RUN DATED 27/08/08 PAGE 1
--------------------------------------------------------------
FPLAN FPLAN PRE BTCH BATCH POST BTCH BATCH BATCH ... (1 Reply)
I am sending the output of a file to .csv file.
The output should look like this:
Total Customers Processed:,8
Total Customers Skipped:,0
Total Customers Added:,8
Total Customers Changed:,0
Total Policies Deleted:,0
Total Policies Failed:,0
total:,8
Now i want this output in... (1 Reply)
Hi All,
I have an csv file with three rows, where first containing header deatils. is there any way to make the first row to appear bold using UNIX command.
Input File:
Name Rank
arun 1
babu 2
Expected Output:
Name Rank
arun 1
babu 2 (7 Replies)
Hi,
I need to make some changes in a csv file using awk or perl. Unfortunately, all my attempts have led to nothing so I hope you guys can help me.
I have the following example input file including header(original file has 35 fields):
ABC: DE
Time: 2012/09/07... (3 Replies)
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies
LEARN ABOUT PHP
ldap_modify_batch
LDAP_MODIFY_BATCH(3) 1 LDAP_MODIFY_BATCH(3)ldap_modify_batch - Batch and execute modifications on an LDAP entrySYNOPSIS
bool ldap_modify_batch (resource $link_identifier, string $dn, array $entry)
DESCRIPTION
Modifies an existing entry in the LDAP directory. Allows detailed specification of the modifications to perform.
PARAMETERS
o $link_identifier
- An LDAP link identifier, returned by ldap_connect(3).
o $dn
- The distinguished name of an LDAP entity.
o $entry
- An array that specifies the modifications to make. Each entry in this array is an associative array with two or three keys:
attrib maps to the name of the attribute to modify, modtype maps to the type of modification to perform, and (depending on the
type of modification) values maps to an array of attribute values relevant to the modification. Possible values for modtype
include:
o LDAP_MODIFY_BATCH_ADD - Each value specified through values is added (as an additional value) to the attribute named by
attrib.
o LDAP_MODIFY_BATCH_REMOVE - Each value specified through values is removed from the attribute named by attrib. Any value of
the attribute not contained in the values array will remain untouched.
o LDAP_MODIFY_BATCH_REMOVE_ALL - All values are removed from the attribute named by attrib. A values entry must not be pro-
vided.
o LDAP_MODIFY_BATCH_REPLACE - All current values of the attribute named by attrib are replaced with the values specified
through values.
Note that any value for attrib must be a string, any value for values must be an array of strings, and any value for modtype must
be one of the LDAP_MODIFY_BATCH_* constants listed above.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Add a telephone number to a contact
<?php
$dn = "cn=John Smith,ou=Wizards,dc=example,dc=com";
$modifs = [
[
"attrib" => "telephoneNumber",
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => ["+1 555 555 1717"],
],
];
ldap_modify_batch($connection, $dn, $modifs);
?>
Example #2
Rename a user
<?php
$dn = "cn=John Smith,ou=Wizards,dc=example,dc=com";
$modifs = [
[
"attrib" => "sn",
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
"values" => ["Smith-Jones"],
],
[
"attrib" => "givenName",
"modtype" => LDAP_MODIFY_BATCH_REPLACE,
"values" => ["Jack"],
],
];
ldap_modify_batch($connection, $dn, $modifs);
ldap_rename($connection, $dn, "cn=Jack Smith-Jones", NULL, TRUE);
?>
Example #3
Add two e-mail addresses to a user
<?php
$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
$modifs = [
[
"attrib" => "mail",
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => [
"jack.smith@example.com",
"jack.smith-jones@example.com",
],
],
];
ldap_modify_batch($connection, $dn, $modifs);
?>
Example #4
Change a user's password
<?php
$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=example,dc=com";
$modifs = [
[
"attrib" => "userPassword",
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
"values" => ["Tr0ub4dor&3"],
],
[
"attrib" => "userPassword",
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => ["correct horse battery staple"],
],
];
ldap_modify_batch($connection, $dn, $modifs);
?>
Example #5
Change a user's password (Active Directory)
<?php
function adifyPw($pw)
{
return iconv("UTF-8", "UTF-16LE", '"' . $pw . '"');
}
$dn = "cn=Jack Smith-Jones,ou=Wizards,dc=ad,dc=example,dc=com";
$modifs = [
[
"attrib" => "unicodePwd",
"modtype" => LDAP_MODIFY_BATCH_REMOVE,
"values" => [adifyPw("Tr0ub4dor&3")],
],
[
"attrib" => "unicodePwd",
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => [adifyPw("correct horse battery staple")],
],
];
ldap_modify_batch($connection, $dn, $modifs);
PHP Documentation Group LDAP_MODIFY_BATCH(3)