Seeking for your assistance on how to combine two fields if there's a comma between them.
What i did was, extract the records from database.
file1.csv(extracted from db)
As you can see there's a comma on Field 2 and 3(| delimeted), if you will open it in csv the field 2 and will be consist of 2 fields same field 3 because of the csv comma delimeted.
CSV output
My Expected output in the csv file:
i used awk but still wrong
Please advise,
Thanks,
Moderator's Comments:
When presenting input and output that contains multiple adjacent spaces and input and output lines that do not otherwise fit on a single line; using CODE tags is crucial for people reading your posts to understand what you are trying to do.
You have been placed in read-only mode for a few days for your repeated refusal to use CODE tags when they are required. Read the e-mail that you received explaining why you have you received your 5th infraction for not using CODE tags. Look at the tutorial included in that e-mail. And, please start using CODE tags as required by forum rules instead of expecting moderators and administrators to format your posts for you.
Continued refusal to use CODE tags properly may result in you being permanently barred from posting in the UNIX & Linux Forums.
Last edited by Don Cragun; 03-18-2016 at 02:56 AM..
Reason: Add CODE tags again.
Good Morning,
Newbie here. Could someone help with shell scripting that will enable me to combine 2 fields into one eliminating the white space. The fields are fixed but the data of course varies.
For example:
First Name: "George " 20 positions"
Last Name: "Washington " 30 positions"
I need... (2 Replies)
Hi,
I have a comma delimited file. I want to sort the fields alphabetically and again store them in a comma delimited file.
For example, My file looks like this.
abc,aaa,xyz,xxx,def
pqr,ggg,eee,iii,qqq
zyx,lmo,pqr,abc,fff
and I want my output to look like this, all fields sorted... (3 Replies)
I have file like this
FileA:
abc , "helloworld" , america
def,asia, japan
ghi, africa, ipl
Output Needed:
abc,"helloworld",america
def,asia,japan
ghi,africa,ipl
I would like to implement using awk.
I want to trim each field for its leading and trailing spaces. (7 Replies)
Hi Guys,
I have a file as follows:
1 2 3
There are 5 spaces between 1 and 2 and one space between 2 and 3.
I want:
123
How can I do this using awk?
I tried using: (8 Replies)
I have a file with two fields in it delimited by a comma. Some of the first fields are duplicates. I am trying to eliminate any duplicate records in the first field, and combine the second fields in the output file.
For example, if the input is:
Jane,group=A
Bob,group=A
Bob,group=D... (3 Replies)
I am trying to use awk to format the file below, which is tab-delimited. The desired out is space delimited and is in the order of
$9 $13 $2 $10-$11.$10 and $11 are often times multiple values separated by a comma, so the value in $10 is combined with the first value from
$11 using the comma.... (5 Replies)
can anyone help me!!!! How to I parse the CSV file
file name : abc.csv (csv file) The above file containing data like
abv,sfs,,hju,',',jkk wff,fst,,rgr,',',rgr ere,edf,erg,',',rgr,rgr I have a requirement like i have to extract different field and assign them into different... (4 Replies)