Break single line in 4


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Break single line in 4
# 1  
Old 11-04-2011
Break single line in 4

How can i break a single line into 5 lines
Code:
# joseluiz.silvano; Ramal4846; Sala4121; SetorCorregedoria 	host DF04488962 { 		hardware ethernet 00:16:41:68:57:0B; fixed-address 10.100.111.245; 	}

INTO
Code:
# joseluiz.silvano; Ramal4846; Sala4121; SetorCorregedoria
	host DF04488962 {
		hardware ethernet 00:16:41:68:57:0B;
		fixed-address 10.100.111.245;
		}

Any ideas? Thankz
Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.
# 2  
Old 11-04-2011
What's your system?

What's your shell?
# 3  
Old 11-04-2011
Assuming host is a fixed value, you could so something like:
Code:
sed "s/\( *host.*{\)\(.*;\)\(.*;\)/\n\1\n\2\n\3\n/" infile

This User Gave Thanks to CarloM For This Post:
# 4  
Old 11-04-2011
Ubuntu and bash

---------- Post updated at 12:31 PM ---------- Previous update was at 12:20 PM ----------

Its possible to reverse this option making the lines become 1 ?
# 5  
Old 11-04-2011
All lines in the file into 1 line, or every 5 lines into 1 line?
# 6  
Old 11-04-2011
Every 5 into 1 in the file!? =)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Break a single URL line

I have a single line below in a file, i can have multiple also <java.net.URL>http://server:port/abcd/MaintainRequest.do?operation=121&amp;requestId=123456789&amp;subrequestId=123654789</java.net.URL> I want below to get below output http://server:port/abcd subrequestId=123654789 I am trying... (9 Replies)
Discussion started by: mirwasim
9 Replies

2. Shell Programming and Scripting

How to break the line to the one above?

Hello everyone! I'm trying to make the below file1 look like file2, can anyone help? Basically I just hit backspace on every line that starts with a number. Thanks! file1: THIS#IS-IT1 4 THIS#IS-IT2 3 THIS#IS-IT3 2 THIS#IS-IT4 1 Result > file2: (4 Replies)
Discussion started by: demmel
4 Replies

3. Shell Programming and Scripting

break from a single list into multiple columns

Hi Guys, I am prety new to the hell scripting world. I am running some grep/cut commands and extracting from a csv file into a list. But the final product I need is that the whole list that I now have has to be broken and separated into columns. Say what I now have extracted is a list of... (6 Replies)
Discussion started by: h_rishi
6 Replies

4. Shell Programming and Scripting

Line Break problem

Hi All, Please can you advise/help on the below issue i did a bcp out of a table, it is having problem of line break such that one line is getting broken in two lines for many records. eg Correct format Line 1: - 000f00000bfe2c2c 000218310300000000GBP GBP 734654 10970.35 ... (3 Replies)
Discussion started by: mad_man12
3 Replies

5. UNIX for Dummies Questions & Answers

VI Line Break?

So I'm in a Unix class and our assignment was to go into VI and write a script to make this file tree. At the end of it, I'd like it to echo "This is the file tree you've created" then a line break, then . But I'm not sure as to who to do it. Is there a way for when I run it (./filesystem), the... (4 Replies)
Discussion started by: bbowers
4 Replies

6. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

7. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

8. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

9. Shell Programming and Scripting

Break lines up into single lines after each space in every line

It sounds a bit confusing but what I have is a text file like the example below (without the Line1, Line2, Line3 etc. of course) and I want to move every group of characters into a new line after each space. Example of text file; line1 .digg-widget-theme2 ul { background: rgb(0, 0, 0) none... (7 Replies)
Discussion started by: lewk
7 Replies

10. Shell Programming and Scripting

TO break a line

hi All, Have a doubt in ksh..Am not familiar with arrays but i have tried out a script.. plzzzzz correct me with the script My i/p File is: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) (Port = 1525) ) ) (CONNECT_DATA = (SID = TESTDB1) ) ) ... (7 Replies)
Discussion started by: aajan
7 Replies
Login or Register to Ask a Question