With the sample input shown in post #9 stored in a file named file.csv, the following code:
produces the output requested in post #9:
But note that it removes <newline> and <vertical-bar> characters found between pairs of <double-quote> characters; it does NOT replace them with <NUL> characters. Replacing those characters with <NUL> characters would give you a binary file instead of a text file.
If someone else wants to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
If you uncomment the commented out printf() statements, you can get an inside view at how it accumulates records and removes unwanted <vertical-bar>s and <newline>s.
I have various column names within double quotes, separated by commas.
Example:
"column one", "column number two", "this is column number three", anothercolumn, yetanothercolumn
I need to eliminate the double quotes and replace the blanks within the double quotes by underscores, giving:
... (5 Replies)
Hi Experts,
I have a file with some of the records contain double quotes. If I found a double quote(") in any particular record , I need to look for the next double quote in that particular record and in between these quotes, if any comma(,) is there I need to replace with Tilde (~) in the same... (12 Replies)
Hi,
Could you please help me in removal of newline chracter present in between the double quotes and replacing it with space.
For example ...
Every field is wrapped with double quotes with comma delimiter, so I need to travese from first double quote occerence to till second double... (7 Replies)
Unix superusers,
I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
I have a file with a lot of lines (a lot!) that contain 10 digits between double quotes. ie "1726937489". The digits are random throughout, but always contain ten digits.
I can not for the life of me, (via scouring the internet and grep how-to manuals) figure out how to find this when I search.... (3 Replies)
hi
Need to run below command on remote server:
cmd -a "1 2" -b 3
If i run below, there's clash matching double quotes and fail.
ssh $server "cmd -a "1 2" -b 3"
I have few ideas which worked (like keeping the entire cmd in a file and copy it to remote server and then run that file)... (1 Reply)
Hi,
Trying to change the prompt. I have the following code.
export PS1='
<${USER}@`hostname -s`>$ '
The hostname is not displayed
<abc@`hostname -s`>$ uname -a
AIX xyz 1 6 00F736154C00
<adcwl4h@`hostname -s`>$
If I use double quotes, then the hostname is printed properly but... (3 Replies)
Hi All,
I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes.
Sample Data :
"221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Hi All,
I have my data like below
"1","abc,db","hac,aron","4","5"
Now I need to extract 1,2,4th columns
Output should be like
"1",abc,db","4"
Am trying to use cut command but not able to get the results.
Thanks in advance. (4 Replies)
Hi All,
I am getting .csv file whenever there is a comma present between a field that field get enclosed with double quotes
For eg as below
abc,123,xxyy,2178
fgh,123,"x,x"yy",2178
ghi,123,"x,xyy",2178
jkl,123,xx"yy,2178
whereas I want my data as per below
abc,123,xxyy,2178... (1 Reply)
Discussion started by: H_bansal
1 Replies
LEARN ABOUT PHP
dbase_replace_record
DBASE_REPLACE_RECORD(3) 1 DBASE_REPLACE_RECORD(3)dbase_replace_record - Replaces a record in a databaseSYNOPSIS
bool dbase_replace_record (int $dbase_identifier, array $record, int $record_number)
DESCRIPTION
Replaces the given record in the database with the given data.
PARAMETERS
o $dbase_identifier
- The database link identifier, returned by dbase_open(3) or dbase_create(3).
o $record
- An indexed array of data. The number of items must be equal to the number of fields in the database, otherwise
dbase_replace_record(3) will fail.
Note
If you're using dbase_get_record(3) return value for this parameter, remember to reset the key named deleted.
o $record_number
- An integer which spans from 1 to the number of records in the database (as returned by dbase_numrecords(3)).
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Updating a record in the database
<?php
// open in read-write mode
$db = dbase_open('/tmp/test.dbf', 2);
if ($db) {
// gets the old row
$row = dbase_get_record_with_names($db, 1);
// remove the 'deleted' entry
unset($row['deleted']);
// Update the date field with the current timestamp
$row['date'] = date('Ymd');
// Replace the record
dbase_replace_record($db, $row, 1);
dbase_close($db);
}
?>
SEE ALSO dbase_add_record(3), dbase_delete_record(3).
PHP Documentation Group DBASE_REPLACE_RECORD(3)