Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"find" help

Posted on 2004-10-13
7
Medium Priority
?
204 Views
Last Modified: 2013-11-13
Can someone please show me how to use the find command to search a directory and all subdirectories (all files) and replace all instances of \r\n with \r?  I've got some windows text files that I need to convert to unix style.  Any other method to easily do this would also be acceptable.

Thanks
0
Comment
Question by:dirtdart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 11

Expert Comment

by:avizit
ID: 12304835
there is a better way to do this if your system has it ..

the command to use is "dos2unix"  

try

find . -type f | xargs dos2unix

0
 
LVL 5

Author Comment

by:dirtdart
ID: 12304845
I'm running Slack 10 and it doesn't look like it's installed.  Is this something I can download?
0
 
LVL 11

Expert Comment

by:avizit
ID: 12304847
be warned not that you should do that only for txt files

so maybe you can modify it to


find . -type f -name "*.txt" | xargs dos2unix

if all your files have extension .txt ,
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Author Comment

by:dirtdart
ID: 12304856
Thanks.  I just found a download site.  They're all php files, so it should work the same.  Let me give it a try when I get my files transferred and if it works, I'll come back and reward the points.
0
 
LVL 11

Expert Comment

by:avizit
ID: 12304860
you can get dos2unix sources from
http://www.megaloman.com/~hany/software/hd2u/

or if you can install using rpm you can get the dos2unix rpm from rpmfind.net
0
 
LVL 11

Accepted Solution

by:
avizit earned 2000 total points
ID: 12304872
getting "dos2unix" is preferable cos the other solutions ( check http://mikeage.net/content/tips/linux/dos2unix.php )
creates a new file , so you have to save that as tempfile and then move the tempfile over the original file . hence your script becomes messy .

dos2unix and unix2dos works on the same file ..hence better IMHO
0
 
LVL 5

Author Comment

by:dirtdart
ID: 12306908
Worked like a charm!  Thanks for the help.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question