473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to replace comma with newline n/ in a specific column content of a csv file

Example:
having this header:
User Name JobCodes

and the data for each column:
w004,William,100
jme3,Jhon,200

the challenge is coming here, this particular record has more than one "JobCode":
v4002,Victor,300,400,500

so, these 3 values belong only to "JobCode" column, How can i replace commas with newlines having the expected result for this particular record:

v4002,Victor, 300
400
500

it is possible to get this format for that particular column?? please help!!!
Sep 25 '15 #1
3 4559
the job codes should be listed in order, in this way inside JobCodes column:
300
400
500
Sep 25 '15 #2
RonB
589 Expert Mod 512MB
Putting the JobCodes on separate lines like that will break the csv formatting. Instead, that list should be enclosed in quotes to retain proper csv format.
Sep 25 '15 #3
Oralloy
988 Expert 512MB
ulitech,

Are you looking to create a long-term tool, or a throw-away?

In other words, what are the full requirements, so that we know best how to guide you.

Take a look at the "awk" tool, as it should be able to solve your problem with a line or two.

Alternately, the "sed" tool might be appropriate to your needs.

Luck,
Oralloy
Sep 1 '16 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: padam.singh | last post by:
Hi, I enable All Warnings during compiling my programs. What is the significance of this warning: warning: no newline at end of file I use gcc to compile, but wonder why it needs a newline...
0
by: Leeor Chernov | last post by:
Hi , I am using the method: DSSap.ReadXml( XmlPath,XmlReadMode.InferSchema ); And as I expected I get an error when the xml does not matching my DataSet that contains already a schema , The...
2
by: TB | last post by:
Before displaying the result of a table called "people" in a datagrid called "mydatagrid", I need to modify the content of a column called "moreinfo" in the in-memory datatable (but not the...
0
by: Problematic coder | last post by:
Hi, I have just been asked to create an app that will import a specific column from an excel spreadsheet, something like sheet1 columnD or a column with the first row with a value of 'ID'...
6
convexcube
by: convexcube | last post by:
After searching the web for a solution to total a specific column in a list box and not finding it, I came up with this: Dim varTotal As Currency Dim varRow As Integer For varRow = 1 To...
7
by: cesco | last post by:
Hi, I have a file containing four columns of data separated by tabs (\t) and I'd like to read a specific column from it (say the third). Is there any simple way to do this in Python? I've...
2
by: anatanat | last post by:
hello :) I want to bind a combobox to a specific column in a DataTable. I want the combobox items to display distinct values. I tried: combo.datasource = dataTable; combo.DisplayMember =...
2
by: sukatoa | last post by:
I have a table, where it composed of several columns, but i am concerning only on a specific column with datatype varchar under that db table... Now, for example: column: links values: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.