add blank lines after word MAC (sed/awk or perl??)

N

NNTP

I have a file with the following data

192.168.60.161 DOMAINNAME-POWER 03U
192.168.60.161 DOMAINNAME-TEMP 1eU
192.168.60.161 MAC 00-xy-zz-07-bd-8a
192.168.60.179 DOMAINNAME-abacdf 00U
192.168.60.179 DOMAINNAME 00U
192.168.60.179 DOMAINNAME-abacdf 20U
192.168.60.179 DOMAINNAME 1eU
192.168.60.179 MAC 00-xy-8b-1c-08-c7
192.168.60.198 DOMAINNAME-abcd 00U
192.168.60.198 DOMAINNAME 1cU
192.168.60.198 DOMAINNAME 00U
192.168.60.198 DOMAINNAME-abcd 20U
192.168.60.198 DOMAINNAME 1bU
192.168.60.198 DOMAINNAME 1eU
192.168.60.198 DOMAINNAME 1dU
192.168.60.198 MAC 00-zz-aa-bb-8f-35


what I want to do is add blank line after MAC entry for each IP. I am
confortable with awk/sed but can't seem to fig. this out.

do I need perl? or can sed/awk do this?
 
K

Kenny McCormack

I have a file with the following data

192.168.60.161 DOMAINNAME-POWER 03U
192.168.60.161 DOMAINNAME-TEMP 1eU
192.168.60.161 MAC 00-xy-zz-07-bd-8a
192.168.60.179 DOMAINNAME-abacdf 00U
192.168.60.179 DOMAINNAME 00U ....
what I want to do is add blank line after MAC entry for each IP. I am
confortable with awk/sed but can't seem to fig. this out.

do I need perl? or can sed/awk do this?

I don't understand the reference to this mythical language called sed/awk.
Wouldn't it make just as much sense to ask if it could be done in
Fortran/Python?

Anyway, in AWK (2 liner):

1
/MAC/ {print ""}
 
R

rakesh sharma

(e-mail address removed) (NNTP) wrote in message
I have a file with the following data

192.168.60.161 DOMAINNAME-POWER 03U
192.168.60.161 DOMAINNAME-TEMP 1eU
192.168.60.161 MAC 00-xy-zz-07-bd-8a
192.168.60.179 DOMAINNAME-abacdf 00U
192.168.60.179 DOMAINNAME 00U
192.168.60.179 DOMAINNAME-abacdf 20U
192.168.60.179 DOMAINNAME 1eU
192.168.60.179 MAC 00-xy-8b-1c-08-c7
192.168.60.198 DOMAINNAME-abcd 00U
192.168.60.198 DOMAINNAME 1cU
192.168.60.198 DOMAINNAME 00U
192.168.60.198 DOMAINNAME-abcd 20U
192.168.60.198 DOMAINNAME 1bU
192.168.60.198 DOMAINNAME 1eU
192.168.60.198 DOMAINNAME 1dU
192.168.60.198 MAC 00-zz-aa-bb-8f-35


what I want to do is add blank line after MAC entry for each IP. I am
confortable with awk/sed but can't seem to fig. this out.

do I need perl? or can sed/awk do this?

sed -e '/MAC/G' yourfile
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top