To Add extra commas to a CSV file using 2 files...
Hi ,
Based on my previous requirement the code works fine for comma as delimiter.
Now my Req is widened up a bit ..
There will be two set of files .. one with comma as delimiter and other with semi-colon ; as delimiter.
Second Sample file.
With Double Quotes (Semi-Colon Delimited):
Previous Sample files for tour reference:
With out Double Quotes (Comma Delimited): With Double Quotes (Comma Delimited):
The First Solution works fine for Text with out Double Quotes ... The File with comma delimited can come both with Text enclosed with Double Quotes and With our double Quotes.
Please help me with one script which can take care of this ...
Thanks in Advance.
---------- Post updated 07-03-12 at 12:13 PM ---------- Previous update was 07-02-12 at 03:26 PM ----------
hello all,
i have a comma delimited file.
i want to replace the commas in the file with the tilde symbol using sed.
how can i do this?
thanks. (4 Replies)
hi
how do i manipulate .csv file to add an extra row after each row using shell script?
I need a blank line added for each 1000 records in my file?
I will then need to copy and paste some data in the blank row created.
thanks 4 ur support
neil (3 Replies)
I have a file as follows:
1,"This is field 2",3,4,5
2,"This is field 2 it can contain one , comma",3,4,5
3,"This is field 2 it also, can, contain, more",3,4,5
4,"This is field 2 without extra commas",3,4,5
and i pass this through to awk:
awk -F, ' {
if (... (3 Replies)
Hello everyone I'm new here and this is my first post so first of all I want to say that this is a great forum and I have managed to found most of my answers in these forums : )
So with that I ask you my first question:
I have an excel file which I saved as a csv. However the excel file... (3 Replies)
Trying in this forum. Not sure if it is permitted.... but in need of help.
Please find the requirements in the below link.
https://www.unix.com/unix-dummies-questions-answers/191503-add-extra-commas-csv-file-2.html#post302665179
Thanks in Advance. (1 Reply)
Hi All,
I got this requirement to process a complex CSV file.
Eg File.
Line 1: Name:,XYz
Line 2: Age:,15
Line 3: Grade:,7
Line 4:
Line 5: English, Maths, Science,Spanish
Line 6:10,11,13,14
As you can see the maximum column is 4 . The file i need to make is
Line 1: Name:,XYz,,... (12 Replies)
Hello experts,
I need to validate a csv file which contains data like this:
Sample.csv
"ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0
"ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0
I just need to check if all the records contain exactly the number of... (5 Replies)
Hi
I'm creating a sh script to generate a csv file. The CSV contains the values from a sql table.
The content looks this:
a,b,c,c2,c3,,,,,,,,,,,d,e
I have some code that can separate the fields using the comma as delimiter, but some values actually contain commas, such as... (2 Replies)
how to remove unwanted commas from a .csv file
Input file format
"Server1","server-PRI-Windows","PRI-VC01","Microsoft Windows Server 2012, (64-bit)","Powered On","1,696.12","server-GEN-SFCHT2-VMS-R013,server-GEN-SFCHT2-VMS-R031,server-GEN-SFCHT2-VMS-R023"... (5 Replies)
Discussion started by: ranjancom2000
5 Replies
LEARN ABOUT PHP
strrchr
STRRCHR(3) 1 STRRCHR(3)strrchr - Find the last occurrence of a character in a stringSYNOPSIS
string strrchr (string $haystack, mixed $needle)
DESCRIPTION
This function returns the portion of $haystack which starts at the last occurrence of $needle and goes until the end of $haystack.
PARAMETERS
o $haystack
- The string to search in
o $needle
- If $needle contains more than one character, only the first is used. This behavior is different from that of strstr(3). If
$needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
RETURN VALUES
This function returns the portion of string, or FALSE if $needle is not found.
CHANGELOG
+--------+------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+------------------------------------+
| 4.3.0 | |
| | |
| | This function is now binary safe. |
| | |
+--------+------------------------------------+
EXAMPLES
Example #1
strrchr(3) example
<?php
// get last directory in $PATH
$dir = substr(strrchr($PATH, ":"), 1);
// get everything after last newline
$text = "Line 1
Line 2
Line 3";
$last = substr(strrchr($text, 10), 1 );
?>
NOTES
Note
This function is binary-safe.
SEE ALSO strstr(3), strrpos(3).
PHP Documentation Group STRRCHR(3)