'Need  Script to rename MAC addreses in a csv file.

Posted on 2013-07-01
Medium Priority
Last Modified: 2013-07-02
Need  Script to rename MAC addreses from 0022446688 to 00-22-44-66-88 is a csv file or txt file.

Thank you in advance :)
Question by:firmapost
  • 2
  • 2
LVL 42

Expert Comment

by:Meir Rivkin
ID: 39290113
u need to update the csv file?
can u explain?
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39290133
response.write newMac("0022446688")

function newMAC(x)
end function

Open in new window


Author Comment

ID: 39291811
Basically got a csv file that has 400 mac addresses in it , but i need the macs to look like 00-22-44-66-88 . So a macro to edit the cvs file or something.

macs are stored in the first column of the cvs file.
LVL 42

Accepted Solution

Meir Rivkin earned 2000 total points
ID: 39292266
do u have any other columns in the csv?
do u have header in the csv?

if the file is just list of mac addresses then u can use this PS script:
$csv = gc c:\temp\result.csv
$csv | %{
	([regex]::matches($_, '.{2}') | %{$_.value}) -join '-'
} | sc c:\temp\result.csv

Open in new window


Author Comment

ID: 39292606
In colum nr2 theres Computer Asset.
No headers.

Just :

row 1 |row 2
mac    | asset

Ps script worked butifully :) Thank you

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question