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
replace charandevu Shell Programming and Scripting 6 04-07-2008 11:30 AM
replace last / by | naikaa Shell Programming and Scripting 6 01-17-2008 02:19 AM
How to replace into Vi ravi.sadani19 Shell Programming and Scripting 5 06-25-2007 09:30 AM
How to replace using SED? mahatma Shell Programming and Scripting 4 03-23-2006 03:04 PM
Replace jda2001 UNIX for Dummies Questions & Answers 2 09-06-2005 02:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-19-2006
Chanakya.m's Avatar
Chanakya.m Chanakya.m is offline
Registered User
  
 

Join Date: Jan 2006
Location: Bangalore, India
Posts: 55
Replace \n with \r\n

Hi Dudes,
I want to replace \n with \r\n through out the file. For this I opened vi editor there tried with " s/\\n/\\r\\n/g ", with this I must be able to satisfy my requirements. But it is searching for the current line (Where cursor is). I need this for entire file. No problem if it is with sed or awk. I dont have much idea on them.


Thanks in advance,

Regards,
Chanakya
  #2 (permalink)  
Old 07-19-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
ux2dos (some systems: unix2dos) will convert those the file the way you want.
Code:
ux2dos oldfile > newfile
man ux2dos
  #3 (permalink)  
Old 07-19-2006
Chanakya.m's Avatar
Chanakya.m Chanakya.m is offline
Registered User
  
 

Join Date: Jan 2006
Location: Bangalore, India
Posts: 55
I need to change \n to \r\n in all the satements of file ..

Ex : printf("\nLINUX\n"); to be converted to printf("\r\nLINUX\r\n");
  #4 (permalink)  
Old 07-19-2006
Chanakya.m's Avatar
Chanakya.m Chanakya.m is offline
Registered User
  
 

Join Date: Jan 2006
Location: Bangalore, India
Posts: 55
I got the solution. can be done with the statement

%s/\\n/\\r\\n/g

Thanks
Sponsored Links
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 07:44 AM.


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