Solved

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

Posted on 2013-07-01
5
322 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
  • 2
  • 2
5 Comments
 
LVL 42

Expert Comment

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

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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now