The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading ps command's output line by line s. murat Shell Programming and Scripting 5 05-22-2008 01:23 AM
how to make a line BLINKING in output and also how to increase font size in output mail2sant Shell Programming and Scripting 3 04-14-2008 04:30 AM
Multi-line output to single line LinuxRacr Shell Programming and Scripting 7 02-26-2008 07:05 AM
How to get only the first line of output? sanchopansa Shell Programming and Scripting 12 10-09-2006 01:04 PM
Making multi line output appear on one line djsal Shell Programming and Scripting 1 10-07-2004 03:21 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-04-2008
Registered User
 

Join Date: Apr 2008
Posts: 5
sed output without a new line

I am reading file and extracting the paragraph between START and END tags.

contents of abc.txt
Remember that $ means the last line in a file. You can also specify a range based on two regexps. Try
START
Note that this prints all blocks starting with lines containing regexp1
through lines containing regexp2, not just the first one. If there isn't a matching regexp2 for a line containing regexp1, then we get all lines through to the end of the file.
END

Code:
filename = "abc.text"
sed -n "/START/,/END/p'  $filename > output.dat
but the content of the output i am getting is without newline.

I get the ouput as the regexp is.but without a newline at the end of the line to each line.


How do i get the output each line ending with newline.

Last edited by ganesh_mak; 06-04-2008 at 07:50 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 06-04-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 1,031
Looks flawless. Your textfile might have something else but newlines that is not recognized by sed (maybe crlf ie. ^M from windows?).
Do an
Code:
od -cx yourtextfile
If the newlines show up as single "\n", then I don't know what's wrong.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0