Re: [UNIX NEWBIE] - scripting help

From: Mark A. Heilpern (heilpern@mindspring.com)
Date: 02/12/99


What Eric presented was an alternative to your dos2unix tool, not a way
to handle an entire directory. How you script a mass conversion is
based on the shell you use. As long as you've got bash in /bin/bash,
try:


#!/bin/bash
for filename in *.c; do
  dos2unix $filename >_tmp_file
  mv _tmp_file $filename
done
#--------- end of the script. make the script executable!



You'll note I didn't rename the file to have a k on the end, I just
made it more simple since it's a temp file only.

At 11:02 AM 2/12/99 -0600, you wrote:
>try something like....
>
>/bin/ls -1 | gawk '{system("tr -d \"\\015\" < "$1" > "$1".tmp");system("mv
>"$1".tmp "$1);}'
>
>Eric
>
>> dos2unix act.comm.c > act.comm.ck
>> mv act.comm.ck act.comm.c
>> dos2unix ban.c > ban.ck
>> mv ban.ck ban.c
>> etc etc...


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST