12-14-2017
Since you are creating the file, why not use a different delimiter than the comma? Semi-colon, pipe, tilde are all delimiters I have used to separate fields. Then just alter the other program to know the different delimiter.
This User Gave Thanks to joeyg For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Dear all
I have a file which looks like this
xxxxxxxxxxxxxx,xxx,xxxxxxxxxx
xxxxxxxxxxxxxx,xxx,xxxxxxxxxx
etc
basically 14 characters then a comma, three characters, then a comma then 10 characters. We are uploading this file to our mainframe and they want the commas removed, so it... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
2. HP-UX
Hi Gurus,
There is a ASCII file in which a comma is used as a seperator for the amount field when the amount exceed seven digits: e.g. 0001300,000. Now, this comma needs to be removed from this field, after padding leading zeros (to maintain the ASCII positions) e.g. 00001300000.... (1 Reply)
Discussion started by: pranag21
1 Replies
3. Shell Programming and Scripting
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)
Discussion started by: femig
4 Replies
4. Shell Programming and Scripting
Hi ,
Im relatively new to unix and have to process a comma serparated flat file . I recieve some of the fields in double quotes and i want to remove it ..
INPUT
====
filed1,field2,field3,"fie,ld4"
OUTPUT
=====
field1,field2,field3,"field4"
can anyone tell me how to achieve... (10 Replies)
Discussion started by: r_t_1601
10 Replies
5. Shell Programming and Scripting
i am recieving a flat file ( comma seperated ) with comma in between double quotes in any of the source fields . i need to remove the comma in double quotes and process the file thereafter
fields in file
=========
col1,col2,col3,col4
input can be any of the followng... (31 Replies)
Discussion started by: r_t_1601
31 Replies
6. Shell Programming and Scripting
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)
Discussion started by: Spunkerspawn
3 Replies
7. Shell Programming and Scripting
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)
Discussion started by: chillblue
1 Replies
8. UNIX for Dummies Questions & Answers
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... (1 Reply)
Discussion started by: chillblue
1 Replies
9. UNIX for Dummies Questions & Answers
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)
Discussion started by: chillblue
12 Replies
10. Shell Programming and Scripting
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 PLAN9
getfields
GETFIELDS(2) System Calls Manual GETFIELDS(2)
NAME
getfields, getmfields, setfields, tokenize - break a string into fields
SYNOPSIS
#include <u.h>
#include <libc.h>
int getfields(char *str, char **ptrs, int nptrs)
int getmfields(char *str, char **ptrs, int nptrs)
char* setfields(char *fielddelim)
int tokenize(char *str, char **args, int max)
DESCRIPTION
Getfields breaks the null-terminated string str into at most nptrs null-terminated fields and places pointers to the start of these fields
in the array ptrs. It returns the number of fields and terminates the list of pointers with a zero pointer. It overwrites some of the
bytes in str. If there are nptr or more fields, the list will not end with zero and the last `field' will extend to the end of the input
string and may contain delimiters.
A field is defined as a maximal sequence of characters not in a set of field delimiters. Adjacent fields are separated by exactly one
delimiter. No field follows a delimiter at the end of string. Thus a string of just two delimiter characters contains two empty fields,
and a nonempty string with no delimiters contains one field.
Getmfields is the same as getfields except that fields are separated by maximal strings of field delimiters rather than just one.
Setfields makes the field delimiters (space and tab by default) be the characters of the string fielddelim and returns a pointer to a
string of the previous delimiters.
Tokenize breaks null-terminated string str into tokens by replacing every blank or newline with a null byte. Pointers to successive non-
empty tokens are placed in args. Processing stops after max tokens are processed. Tokenize returns the number of tokens processed. Tok-
enize does not terminate args with a null pointer.
Alef
Of these routines, only tokenize is in Alef.
SOURCE
/sys/src/libc/port/getfields.c
/sys/src/libc/port/tokenize.c
SEE ALSO
strtok in strcat(2)
GETFIELDS(2)