How to Concatenate two column values in a CSV file Using PowerShell

#Import the CSV file in the Variable and Select the column names that you want to be displayed into #updated CSV file

$CSV = import-csv “D:\CSV File\Temp.csv” | select Surname,Given_Names,Email_Address,Employee_ID,Employee_Number,User_Name,Position_Title,

@{n=’ResourceName’;e={$_.Surname + ” ” + $_.Given_Names}}

# script @{n=’ResourceName’;e={$_.Surname + ” ” + $_.Given_Names}} will create the new #column Resource name and concatenate the Surname and Given_Names Column Value

# Export the data from the Variable $CSV to the new file

$CSV | export-CSV “D:\Temp File\Temp1.csv”

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: