Add CSV fields containing header names, and hash of concatenated data
up vote
-1
down vote
favorite
I have a requirement to concatenate multiple columns dynamically based on header:
Sample input:
id|name|age|gender
10|a|30|m
20|b|20|f
Output:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,name|o/pvalue(md5 (10,a))
20|b|20|f|id,name|o/p value(md5 20,b))
Or:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,gender|o/pvalue(md5 (10,m))
20|b|20|f|id,gender|o/p value(md5 20,f))
And so on...
so idea here is to pass the column names to be concatenated in an array dynamically and loop through all lines in the file and add two extra columns with contains which columns are being concatenated and whats their hash value.
please advise or point me towards the right approach.
thanks
shell
add a comment |
up vote
-1
down vote
favorite
I have a requirement to concatenate multiple columns dynamically based on header:
Sample input:
id|name|age|gender
10|a|30|m
20|b|20|f
Output:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,name|o/pvalue(md5 (10,a))
20|b|20|f|id,name|o/p value(md5 20,b))
Or:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,gender|o/pvalue(md5 (10,m))
20|b|20|f|id,gender|o/p value(md5 20,f))
And so on...
so idea here is to pass the column names to be concatenated in an array dynamically and loop through all lines in the file and add two extra columns with contains which columns are being concatenated and whats their hash value.
please advise or point me towards the right approach.
thanks
shell
What's the difference betweeno/pvalue
ando/p value
? Where does the control information about how calculated columns and function come from? There's a lot of missing information here. Please read about how to create an MCVE (Minimal, Complete, and Verifiable example). It is good that you've shown some input and some output; it is a pity that you've not shown all the input information, nor your best effort to solve the problem. We will help fix honest attempts at solving problems; we won't usually write the code for you.
– Jonathan Leffler
Nov 11 at 3:21
@JonathanLeffler, Thanks for the feed back I will keep in mind whenever i am going to post new questions. also i was not dumping my work on other developers but from my poor framing of the question i can see why you felt so. I did try a few things none of them worked until some one in the community helped me out writing it. This is the code that works for my requirement.ideone.com/T9YNMP
– kumarm
Nov 11 at 19:13
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a requirement to concatenate multiple columns dynamically based on header:
Sample input:
id|name|age|gender
10|a|30|m
20|b|20|f
Output:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,name|o/pvalue(md5 (10,a))
20|b|20|f|id,name|o/p value(md5 20,b))
Or:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,gender|o/pvalue(md5 (10,m))
20|b|20|f|id,gender|o/p value(md5 20,f))
And so on...
so idea here is to pass the column names to be concatenated in an array dynamically and loop through all lines in the file and add two extra columns with contains which columns are being concatenated and whats their hash value.
please advise or point me towards the right approach.
thanks
shell
I have a requirement to concatenate multiple columns dynamically based on header:
Sample input:
id|name|age|gender
10|a|30|m
20|b|20|f
Output:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,name|o/pvalue(md5 (10,a))
20|b|20|f|id,name|o/p value(md5 20,b))
Or:
id|name|age|gender|calculatedcolumns|function
10|a|30|m|id,gender|o/pvalue(md5 (10,m))
20|b|20|f|id,gender|o/p value(md5 20,f))
And so on...
so idea here is to pass the column names to be concatenated in an array dynamically and loop through all lines in the file and add two extra columns with contains which columns are being concatenated and whats their hash value.
please advise or point me towards the right approach.
thanks
shell
shell
edited Nov 12 at 0:13
agc
4,6591338
4,6591338
asked Nov 11 at 2:19
kumarm
64
64
What's the difference betweeno/pvalue
ando/p value
? Where does the control information about how calculated columns and function come from? There's a lot of missing information here. Please read about how to create an MCVE (Minimal, Complete, and Verifiable example). It is good that you've shown some input and some output; it is a pity that you've not shown all the input information, nor your best effort to solve the problem. We will help fix honest attempts at solving problems; we won't usually write the code for you.
– Jonathan Leffler
Nov 11 at 3:21
@JonathanLeffler, Thanks for the feed back I will keep in mind whenever i am going to post new questions. also i was not dumping my work on other developers but from my poor framing of the question i can see why you felt so. I did try a few things none of them worked until some one in the community helped me out writing it. This is the code that works for my requirement.ideone.com/T9YNMP
– kumarm
Nov 11 at 19:13
add a comment |
What's the difference betweeno/pvalue
ando/p value
? Where does the control information about how calculated columns and function come from? There's a lot of missing information here. Please read about how to create an MCVE (Minimal, Complete, and Verifiable example). It is good that you've shown some input and some output; it is a pity that you've not shown all the input information, nor your best effort to solve the problem. We will help fix honest attempts at solving problems; we won't usually write the code for you.
– Jonathan Leffler
Nov 11 at 3:21
@JonathanLeffler, Thanks for the feed back I will keep in mind whenever i am going to post new questions. also i was not dumping my work on other developers but from my poor framing of the question i can see why you felt so. I did try a few things none of them worked until some one in the community helped me out writing it. This is the code that works for my requirement.ideone.com/T9YNMP
– kumarm
Nov 11 at 19:13
What's the difference between
o/pvalue
and o/p value
? Where does the control information about how calculated columns and function come from? There's a lot of missing information here. Please read about how to create an MCVE (Minimal, Complete, and Verifiable example). It is good that you've shown some input and some output; it is a pity that you've not shown all the input information, nor your best effort to solve the problem. We will help fix honest attempts at solving problems; we won't usually write the code for you.– Jonathan Leffler
Nov 11 at 3:21
What's the difference between
o/pvalue
and o/p value
? Where does the control information about how calculated columns and function come from? There's a lot of missing information here. Please read about how to create an MCVE (Minimal, Complete, and Verifiable example). It is good that you've shown some input and some output; it is a pity that you've not shown all the input information, nor your best effort to solve the problem. We will help fix honest attempts at solving problems; we won't usually write the code for you.– Jonathan Leffler
Nov 11 at 3:21
@JonathanLeffler, Thanks for the feed back I will keep in mind whenever i am going to post new questions. also i was not dumping my work on other developers but from my poor framing of the question i can see why you felt so. I did try a few things none of them worked until some one in the community helped me out writing it. This is the code that works for my requirement.ideone.com/T9YNMP
– kumarm
Nov 11 at 19:13
@JonathanLeffler, Thanks for the feed back I will keep in mind whenever i am going to post new questions. also i was not dumping my work on other developers but from my poor framing of the question i can see why you felt so. I did try a few things none of them worked until some one in the community helped me out writing it. This is the code that works for my requirement.ideone.com/T9YNMP
– kumarm
Nov 11 at 19:13
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245290%2fadd-csv-fields-containing-header-names-and-hash-of-concatenated-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What's the difference between
o/pvalue
ando/p value
? Where does the control information about how calculated columns and function come from? There's a lot of missing information here. Please read about how to create an MCVE (Minimal, Complete, and Verifiable example). It is good that you've shown some input and some output; it is a pity that you've not shown all the input information, nor your best effort to solve the problem. We will help fix honest attempts at solving problems; we won't usually write the code for you.– Jonathan Leffler
Nov 11 at 3:21
@JonathanLeffler, Thanks for the feed back I will keep in mind whenever i am going to post new questions. also i was not dumping my work on other developers but from my poor framing of the question i can see why you felt so. I did try a few things none of them worked until some one in the community helped me out writing it. This is the code that works for my requirement.ideone.com/T9YNMP
– kumarm
Nov 11 at 19:13