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
Replacing nulls using sed novice1324 Shell Programming and Scripting 7 02-26-2008 11:56 PM
help in replacing ?? zedex Shell Programming and Scripting 5 08-30-2007 10:45 PM
Replacing in SED superprogrammer Shell Programming and Scripting 8 07-10-2006 11:33 PM
replacing corrupt /tmp dir.. moxxx68 UNIX for Advanced & Expert Users 6 05-28-2005 03:58 PM
replacing with `pwd` oldtrash Shell Programming and Scripting 6 04-09-2004 03:24 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2002
Registered User
 

Join Date: Feb 2002
Location: Portugal
Posts: 22
Stumble this Post!
replacing \n by \r\n

hi there,

sometimes i want to send some of my friends some text files (they use that OS u know the name), so i'd like to filter all line feeds and replace them by a carriage return + line feed. does anyone know how i can do that?

thx
__________________
[color=green]if you put your mind into it and you're crazy enough, you can accomplish anything[/color]
Forum Sponsor
  #2 (permalink)  
Old 12-07-2002
WIntellect's Avatar
Registered User
 

Join Date: Sep 2002
Location: United Kingdom
Posts: 170
Stumble this Post!
Someone showed me this once (in this forum I believe) - so all credit to that person, but I can't remember who (sorry if you know it was you!); works a treat:
Code:
perl -i -pne "s/\n/\r\n/g" filename
This converts the file directly, so you wont get a different output file. You can then revesre the \n and \r\n to change a Windows file to Unix!!!

Happy converting
__________________
FreeBSD - Opening computers from closed Windows
  #3 (permalink)  
Old 12-09-2002
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Stumble this Post!
See if you have the unix2dos utility installed. It has a counterpart called, you guessed it, dos2unix...

Some systems call it dostounix or dos2ux...

Good luck.
  #4 (permalink)  
Old 11-24-2003
Registered User
 

Join Date: Nov 2003
Posts: 2
Stumble this Post!
Oh... THIS looks like exactly what I NEED! Sorry about the other post!
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:19 PM.


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

Content Relevant URLs by vBSEO 3.2.0