473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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?
Jul 19 '05 #1
2 4475
In article <11*************************@posting.google.com> ,
NNTP <ne******@yahoo.com> wrote:
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 ""}

Jul 19 '05 #2
ne******@yahoo.com (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
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: NNTP | last post by:
I have a script that outputs the following. 200 23.131.155.5; 1 23.131.161.4; 2 102.131.161.54; 2 23.160.180.4; 35 54.1.8.7; 356 15.18.235.52; 1 205.18.235.88; 1 205.18.246.21;
23
by: r.e.s. | last post by:
I have a million-line text file with 100 characters per line, and simply need to determine how many of the lines are distinct. On my PC, this little program just goes to never-never land: def...
2
by: diazhenrique | last post by:
Hi all, How could I substitute the blank lines in my .txt data file. It has many empty lines between groups of "text". In truth, the file is not a well-formated one, in strict sense. I would...
4
by: Andreas Bauer | last post by:
Hi, I have to audit some c# code. I know in the options I can adjust how the code should be formatted while entering it. But is there any way to apply afterwards a code template to the classes...
15
by: Yogi | last post by:
Hi there, I have a quick question. In my html document, I want to make a new paragraph whenever I have a blank line in the html source. Using <p> and </pevery time is kind of cumbersome (I want...
10
by: Raymond | last post by:
For some reason I'm unable to grok Python's string.replace() function. Just trying to parse a simple IP address, wrapped in square brackets, from Postfix logs. In sed this is straightforward given:...
10
by: masinick | last post by:
I am aware that Perl has a lot of features that originally came from sed and awk. I have a pattern that I am using like this: sed -n '/|Y|/p' I want to do the same thing in Perl and be able to...
25
by: tmallen | last post by:
I'm parsing some text files, and I want to strip blank lines in the process. Is there a simpler way to do this than what I have here? lines = filter(lambda line: len(line.strip()) 0, lines) ...
1
by: msxi | last post by:
Hi, I have s sed script that removes the following lines from a db dump file. I would like to remove these lines using perl. Could anybody assist? /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.