awk add Mac Address to new File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk add Mac Address to new File
# 1  
Old 03-14-2009
awk add Mac Address to new File

I have file one containing Mac Addresses minus colon. I would like to add them to a different file with columns seperated by commas. Such as

File 1
0000aa1122
0000aa1123
0000aa1126

Output File
Name, MacAddress,Date
Something, 0000aa1122,Something
Something, 0000aa1123,Something
Something, 0000aa1126,Something

I know awk should be able to do this quite easily but I am unable to work it out. Maybe a different tool would be better. Anyhelp would be appreciated.
# 2  
Old 03-14-2009
Code:
sed 's/.*/Something, &,Something/' File1 > OuputFile

# 3  
Old 03-14-2009
That produced a continuous string of.

Something, 0000aa1122 0000aa1123 0000aa11268, Something . It would be more ideal if it was.

Something, 0000aa1122, Something
Something, 0000aa1123, Something
Something, 0000aa1126, Something

Dividing each entry in the first file and putting it in the middle of each line.

TIA
# 4  
Old 03-15-2009
what's your input file look like?
# 5  
Old 03-15-2009
Looks Like

File 1.

0000aa1122
0000aa1123
0000aa1126

thanks
# 6  
Old 03-15-2009
Quote:
Originally Posted by dolacap
Looks Like

File 1.

0000aa1122
0000aa1123
0000aa1126

thanks
given the file above,
Code:
sed 's/.*/Something, &,Something/' file1

the result looks like this:
Code:
Something, 0000aa1122,Something
Something, 0000aa1123,Something
Something, 0000aa1126,Something

Is that what you want?
If not quote your desired output using the code tags.
# 7  
Old 03-15-2009
Thanks that was it. Not sure what happened the first time. But that output was as desired at first thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

MAC Address - Four Interfaces with the same MAC Address

four interfaces with ifconfig all interfaces have the same mac. If is not set for unique. but it still works. what difference does it make to have all macs the same or different? (4 Replies)
Discussion started by: rrodgers
4 Replies

2. Cybersecurity

File encryption tools with MAC address as an encryption key

Hi all, I'm looking for secure file encryption tools that use MAC address as encryption key. FYI, I'm using Red Hat Enterprise Linux OS. For example: when A wants to send file to B A will encrypt the file with B's computer MAC/IP address as an encryption key This file can only be decrypted... (2 Replies)
Discussion started by: sergionicosta
2 Replies

3. UNIX for Dummies Questions & Answers

Grep /Awk letters X - X in every line and print it as a mac address

hey i m kinda new to this so i will appreciate any help , i have this list of values: pwwn = 0x50012482009cd7a7 nwwn=0x50012482009cd7a6 port_id = 0x280200 pwwn = 0x5001248201bcd7a7 nwwn=0x5001248201bcd7a6 port_id = 0x280300 pwwn = 0x50012482009c51ad nwwn=0x50012482009c51ac port_id =... (4 Replies)
Discussion started by: boaz733
4 Replies

4. IP Networking

Tracing a MAC address to IP address: Solaris

Hi there I lost connectivity to one of our remote systems and when I checked the messages log I found the following: Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1 Aug 16 13:20:51 host... (9 Replies)
Discussion started by: notreallyhere
9 Replies

5. SCO

MAC address

hi every one please help i want to change mac address in sco unix 5.0.6 how can i do this (3 Replies)
Discussion started by: kaydream
3 Replies

6. Solaris

Get ip address from mac address

I have following message in my messages file on solaris 10 WARNING: e1000g3712000:3 has duplicate address 010.022.196.011 (in use by 00:50:56:85:25:ef); disabled Now is there any way i can find which server has 00:50:56:85:25:ef mac address either IP or Hostname ? (6 Replies)
Discussion started by: fugitive
6 Replies

7. Programming

SCO get MAC Address

Does anyone know how to get the mac address of a SCO box using c. (11 Replies)
Discussion started by: jcarter2333
11 Replies

8. IP Networking

How to Achive IP address through MAC(Ethernet) address

Hi sir, i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address....... but i'm nt getting that how i can pass the MAC address to Frame........ Please give me an idea for making such program... Thanks & regards Krishna (3 Replies)
Discussion started by: krishnacins
3 Replies

9. UNIX for Dummies Questions & Answers

Mac address

Hi Can some one help me How do find out Mac address in Tru64 Unix Thank you (1 Reply)
Discussion started by: Syed_45
1 Replies

10. Programming

Get Mac Address

:( Hi I am trying to get Mac address of of my Sun server from my C program running on the host machine. Any suggestions . (1 Reply)
Discussion started by: ss_hpov
1 Replies
Login or Register to Ask a Question