user3697289
user3697289

Reputation: 155

Search and replace all field (CSV)

I have CSV file , and one of the field named 'Involved ST'.
This field can contain values like that:

Before:

Involved ST
V5 3rd
V4 3rd
V6 3rd
G140 2nd
G141 2nd
A2
A3

After:

Involved ST
 3rd
 3rd
 3rd
 2nd
 2nd
 1st
 1st

Now I have to replace each value that contain 3rd (like 'V5 3rd') in -> 3rd
Values that contain 2nd-> 2nd
Else replace with 1st.

Which tool can do that? Thank you!!

Upvotes: 0

Views: 58

Answers (2)

Tim Williams
Tim Williams

Reputation: 166341

If you open the CSV in Excel you can use a formula like:

=IF(A2<>"", CHOOSE(IFERROR(MATCH(RIGHT(A2,3),{"3rd","2nd"},0),3),"3rd","2nd","1st"),"")

or

=IF(A2<>"", IF(ISERROR(MATCH(RIGHT(A2,3),{"3rd","2nd"},0)),"1st",RIGHT(A2,3)), "")

(assuming your values start in A2)

Upvotes: 1

Jimbo
Jimbo

Reputation: 2537

Try powershell - easily reads and writes csv and changing of values.

Upvotes: 1

Related Questions