The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
carriage return or funky character stuck in my variables - help :) audiophile Shell Programming and Scripting 5 09-06-2008 12:29 PM
return value problem ravi raj kumar UNIX for Advanced & Expert Users 3 07-01-2007 01:36 AM
Substituting carriage return followed by newline character - HELP djkane Shell Programming and Scripting 14 02-28-2006 09:58 PM
Substituting carriage return follwed by newline character - HELP! djkane UNIX for Dummies Questions & Answers 1 02-27-2006 09:11 PM
Test return character. gio123bg Shell Programming and Scripting 3 12-09-2003 08:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-18-2008
Santiago Santiago is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 3
sed and character return problem

Hi,
I have a problem with sed. It doesn't recognize the "\n" character. It substitudes an "n", instead of introducing a new line.
This doesn't happend with print $ print "test \n \n" (it deos introduce two lines after hello)
(AIX)

$ sed s/bc/\n/g test.1 >test.2
$ cat test.1
bcdefg
abcdefgafj

$ more test.2
ndefg
andefgafj
The same happend with:
sed 's/bc/\n/g test.1' >test.2
sed "s/bc/\n/g" test.1 >test.2
sed s/"bc"/"\n"/g test.1 >test.2
Anybody has an idea?
thanks
S
  #2 (permalink)  
Old 09-18-2008
avronius avronius is offline VIP Member  
VIP Member
  
 

Join Date: Apr 2008
Location: Calgary
Posts: 305
Same question resolved here:
How to replace any char with newline char.
  #3 (permalink)  
Old 09-18-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
this should work..
Quote:
sed -e 's/searchpattern/(press enter here)
/g' filename
  #4 (permalink)  
Old 09-19-2008
manosubsulo manosubsulo is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 87
Code:
awk '{ sub("bc", "\n"); print }' File Name
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:07 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0