Hi ,
Can some one help in appending the file name to all the rows in .csv files the current work is like this.
This is adding a new line for file name,
I need to append file name to all lines in .csv
for i in `ls $filename*.csv`
do
echo "$i" > ./tmpfile
cat "$i" >> ./tmpfile
mv... (3 Replies)
Hi all,
I need help on this.
I have a file with 4500 bytes. I want to modify the contents of line from 1357 through 3208.
1. Starting 1357, there is 35 occurence of 40 bytes data making it to 2757.
2. The remaining 451 filler with spaces taking it to 3208.
Now, the 40 byte data is... (2 Replies)
I have been trying to find the answer to this but can't seem to get it.
I have two rows, both are CSV files.
I want to iteratively compare each field value to the corresponding value in the second file.
Example:
File 1.txt
1|hello|3.2|AMB||||B
File 2.txt
1|hi|3,2|ABC||||C
The... (1 Reply)
Hello to all members,
I am very new in unix stuff (shell scripting), but a want to learn a lot. I am a ex windows user but now i am absolutely Linux super user... :D
So i am tryng to made a function to do this:
I have two csv files only with numbers, the first one a have:
1
2
3
4
5... (6 Replies)
Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me .
Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer.
I want to create a mutiple output files with each file having a... (2 Replies)
Hello,
I am supposed to process about 100 csv files. But these files have some extra lines at the bottom of the file. these extra lines start with a header for each column and then some values below. These lines are actually a summary of the actual data and not supposed to be processed. These... (8 Replies)
Hi I need a bash shell script that will take text files with 4 rows and different numbers of columns in each row and convert each one into a text file with just one column.
I then subtract 1.5 from each number in the column (I have that part already)
The next step after that is I want to have... (10 Replies)
Hi,
I am trying to place the contents of a .CSV file to an array, but not sure how to do that.
Here is my .CSV file content:
App,SLA,Job name,Avg start time,Avg run time,Frequency,Downstream apps
XYZ,,ABC14345,3:00 AM,00.04.00,Daily,STAMP
XYZ,9:00,ABC12345,3:15 AM,00.05.00,Daily,STAMP
... (4 Replies)
How can i get the duplicates rows from a file using unix, for example i have data like
a,1
b,2
c,3
d,4
a,1
c,3
e,5
i want output to be like
a,1
c,3 (4 Replies)
Discussion started by: ggupta
4 Replies
LEARN ABOUT PHP
pg_copy_from
PG_COPY_FROM(3)PG_COPY_FROM(3)pg_copy_from - Insert records into a table from an arraySYNOPSIS
bool pg_copy_from (resource $connection, string $table_name, array $rows, [string $delimiter], [string $null_as])
DESCRIPTION pg_copy_from(3) inserts records into a table from $rows. It issues a COPY FROM SQL command internally to insert records.
PARAMETERS
o $connection
- PostgreSQL database connection resource.
o $table_name
- Name of the table into which to copy the $rows.
o $rows
- An array of data to be copied into $table_name. Each value in $rows becomes a row in $table_name. Each value in $rows should be
a delimited string of the values to insert into each field. Values should be linefeed terminated.
o $delimiter
- The token that separates values for each field in each element of $rows. Default is TAB.
o $null_as
- How SQL NULL values are represented in the $rows. Default is N ("\N").
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
pg_copy_from(3) example
<?php
$db = pg_connect("dbname=publisher") or die("Could not connect");
$rows = pg_copy_to($db, $table_name);
pg_query($db, "DELETE FROM $table_name");
pg_copy_from($db, $table_name, $rows);
?>
SEE ALSO pg_copy_to(3).
PHP Documentation Group PG_COPY_FROM(3)