Solved

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

Posted on 2013-07-01
5
330 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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;…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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