?
Solved

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

Posted on 2013-07-01
5
Medium Priority
?
333 Views
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 :)
0
Comment
Question by:firmapost
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39290113
u need to update the csv file?
can u explain?
0
 
LVL 53

Expert Comment

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

function newMAC(x)
   newMac=left(x,2)&"-"&mid(x,3,2)&"-"&mid(x,6,2)&"-"&mid(8,2)&"-"&right(x,2)
end function

Open in new window

0
 

Author Comment

by:firmapost
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.
0
 
LVL 42

Accepted Solution

by:
sedgwick 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

0
 

Author Comment

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

Just :

row 1 |row 2
mac    | asset


Ps script worked butifully :) Thank you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 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