I need to delete rows based on the number of lines in a different file, I have a piece of code with me working but when I merge with my C application, it doesnt work.
sed '1,'\"`wc -l < /tmp/fileyyyy`\"'d' /tmp/fileA > /tmp/filexxxx
Can anyone give me an alternate solution for the above (2 Replies)
Hello. I have the following issue: my txt file has the following format:
train/dr4/fklc0/sx175.txt
0 80282 Severe myopia contributed to Ron's inferiority complex.
train/dr4/fklc0/sx355.txt
0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt
awk 'NR%2==0' test1.txt >... (4 Replies)
I have a file which will have rows like shown below,
ST*820*316054716
RMR*IV*11333331009*PO*40.31
REF*IV*22234441009*xsss471-2762
DTM*003*091016
ENT*000006
RMR*IV*2222234444*PO*239.91
REF*IV*1234445451009*LJhjlkhkj471-2762 </SPAN>
DTM*003*
091016
RMR*IV*2223344441009*PO*40.31... (18 Replies)
Can I insert rows based on line numbers. Say If I need to insert 1 or more rows in a file from line number 10. Can I do that in UNIX
I have a file something like
A
B
C
D
E
F
After row C, I wanted to add 2 records as X and Y. I have the line number after C as my reference. Can I... (2 Replies)
Hi All,
I have a file which is like this:
rows.dat
1 2 3 4 5 6
3 4 5 6 7 8
7 8 9 0 4 3
2 3 4 5 6 7
1 2 3 4 5 6
I have another file with numbers like these (numbers.txt):
1
3
4
5
I want to read numbers.txt file line by line. The extract the row from rows.dat based on the... (3 Replies)
Hello friends,
Is there any way to split file from n to n+6 into 1 file and (n+7) to (n+16) into other file etc.
f.e I have source pipe delimated file with 20 lines and i need to split 1-6 in file1 and 7-16 in file2 and 17-20 in file 3
I need to split into fixed number of file like 4 files... (2 Replies)
Hi All
I have one query,say i have a requirement like the below code should be
move to diffent files whose maximum lines can be of 10 lines.Say in the below example,it consist of 14 lines.
This should be moved logically using the data in the fisrt coloumn to file1 and file 2.The data of first... (2 Replies)
I have a tab delimited text file that looks like the following:
ERBB3 0.00097
IL31RA 0.000972
SETD5 0.000972
MCART1 0.000973
CENPJ 0.000973
FNDC6 0.000974
I want to assign a number to each row based on the value in the last column (in the order of increasing value so that the first row... (3 Replies)
Hi All,
I want to keep the name of the songs with their respective extensions only.
Sample Code
========
03 Choti choti gaiya choti choti gaval.mp3
03---Brazil Dhol.mp3
03 PAYALIYA .mp3
04 - Isq Risk .mp3
04%20-%20Oh%20My%20Love(wapking.in).mp3
08 - A2 - Aasan Nahin Yahan .mp3
AE... (3 Replies)
Discussion started by: Pramod_009
3 Replies
LEARN ABOUT PHP
maxdb_affected_rows
MAXDB_AFFECTED_ROWS(3) 1 MAXDB_AFFECTED_ROWS(3)maxdb_affected_rows - Gets the number of affected rows in a previous MaxDB operation
Procedural style
SYNOPSIS
int maxdb_affected_rows (resource $link)
DESCRIPTION
Object oriented style
int$maxdb->affected_rows ()
maxdb_affected_rows(3) returns the number of rows affected by the last INSERT, UPDATE, or DELETE query associated with the provided $link
parameter. If this number cannot be determined, this function will return -1.
Note
For SELECT statements maxdb_affected_rows(3) works like maxdb_num_rows(3).
The maxdb_affected_rows(3) function only works with queries which modify a table. In order to return the number of rows from a SELECT
query, use the maxdb_num_rows(3) function instead.
RETURN VALUES
An integer greater than zero indicates the number of rows affected or retrieved. Zero indicates that no records where updated for an
UPDATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed. -1 indicates that the number of
rows affected can not be determined.
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
maxdb_report (MAXDB_REPORT_OFF);
$maxdb->query("DROP TABLE mycustomer");
maxdb_report (MAXDB_REPORT_ERROR);
/* Insert rows */
$maxdb->query("CREATE TABLE mycustomer AS SELECT * from hotel.customer");
printf("Affected rows (INSERT): %d
", $maxdb->affected_rows);
$maxdb->query("ALTER TABLE mycustomer ADD Status int default 0");
/* update rows */
$maxdb->query("UPDATE mycustomer SET Status=1 WHERE cno > 50");
printf("Affected rows (UPDATE): %d
", $maxdb->affected_rows);
/* delete rows */
$maxdb->query("DELETE FROM mycustomer WHERE cno < 50");
printf("Affected rows (DELETE): %d
", $maxdb->affected_rows);
/* select all rows */
$result = $maxdb->query("SELECT title FROM mycustomer");
printf("Affected rows (SELECT): %d
", $maxdb->affected_rows);
$result->close();
/* Delete table Language */
$maxdb->query("DROP TABLE mycustomer");
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
if (!$link) {
printf("Can't connect to localhost. Error: %s
", maxdb_connect_error());
exit();
}
maxdb_report (MAXDB_REPORT_OFF);
maxdb_query($link,"DROP TABLE mycustomer");
maxdb_report (MAXDB_REPORT_ERROR);
/* Insert rows */
maxdb_query($link, "CREATE TABLE mycustomer AS SELECT * from hotel.customer");
printf("Affected rows (INSERT): %d
", maxdb_affected_rows($link));
maxdb_query($link, "ALTER TABLE mycustomer ADD Status int default 0");
/* update rows */
maxdb_query($link, "UPDATE mycustomer SET Status=1 WHERE cno > 50");
printf("Affected rows (UPDATE): %d
", maxdb_affected_rows($link));
/* delete rows */
maxdb_query($link, "DELETE FROM mycustomer WHERE cno < 50");
printf("Affected rows (DELETE): %d
", maxdb_affected_rows($link));
/* select all rows */
$result = maxdb_query($link, "SELECT title FROM mycustomer");
printf("Affected rows (SELECT): %d
", maxdb_affected_rows($link));
maxdb_free_result($result);
/* Delete table Language */
maxdb_query($link, "DROP TABLE mycustomer");
/* close connection */
maxdb_close($link);
?>
The above example will output something similar to:
Affected rows (INSERT): 15
Affected rows (UPDATE): 15
Affected rows (DELETE): 0
Affected rows (SELECT): 15
SEE ALSO maxdb_num_rows(3), maxdb_info(3).
PHP Documentation Group MAXDB_AFFECTED_ROWS(3)