Unix

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
Home » Development Group »» Unix
  • while read looping continuously

    0 answers - 3221 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg

    There is an easier way -
    Try this perl script.
    You run this on the commandline giving the filename as an argument. Don't forget to make a copy of the file first.
    perl -pi -e 's/^M//g' <filename>
    The way to get the ^M on the line is to hold the <CTLkey and hit "v" and then "m".
    See how this works for you.
    nickb
    Forester1 via ibm-aix-l <ibm-aix-l (AT) Groups (DOT) ITtoolbox.comwrote:
    # data centers - quantify costs, improve architecture
    # See how:
    # View Group Archive:
    Hi all! I have a small script I usually use on small files brought over from Windows, in order to remove ^M from the ends of the lines.
    #! /usr/sbin/sh
    while read i
    do
    sed 's/^M//g' $1 tmpfile
    mv tmpfile $1
    done < $1
    It works very well, but I am now trying it on a failry large (6Mb) text data file with thousands of lines, and it seems to be looping forever. I tried moving the mv statement outside of the do/done loop to see if that would have an effect, and then it just builds up tmpfile until it fills up the file system. Is there some reason why this should be continously looping through the file over and over again instead of stopping at the end?
    Thanks in advance!
    Joel Tompkins
    ERP Support Tech
    [INF] -- Access Manager:
    This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PRHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A2
    //* RELATED WHITE PAPERS
    Server Management Best Practices with PATRL(r)
    3624
    IBM AIX 5L Version 5.2 for PWER, the Demand UNIX System
    0552
    Fusion95 - a fusion between Windows and UNIX
    447
    *//
    Get expert advice on Tiered Storage for FREE
    Visit the Seagate Tiered Storage Knowledge Center now!
    *FAQ:
    *Archives:
    *Manage Subscriptions:
    *Leave Group: mailto:leave-ibm-aix-l (AT) Groups (DOT) ITtoolbox.com
    *Need Subscription Help? mailto:Listmaster (AT) ITtoolbox (DOT) com
    *Terms of Use:
    *Copyright (c) ITtoolbox and message author. No redistribution.
    Yahoo! Personals
    Let fate take it's course directly to your email.
    See who's waiting for you Yahoo! Personals
    //* RELATED WHITE PAPERS
    Server Management Best Practices with PATRL(r)
    IBM AIX 5L Version 5.2 for PWER, the Demand UNIX System
    AIX Affinity With Linux
    *//
    Get expert advice on Tiered Storage for FREE
    Visit the Seagate Tiered Storage Knowledge Center now!
    *FAQ:
    *Archives:
    *Manage Subscriptions:
    *Leave Group: mailto:leave-ibm-aix-l (AT) Groups (DOT) ITtoolbox.com
    *Need Subscription Help? mailto:Listmaster (AT) ITtoolbox (DOT) com
    *Terms of Use:
    *Copyright (c) ITtoolbox and message author. No redistribution.

Re: while read looping continuously


max 4000 letters.
Your nickname that display:
In order to stop the spam: 1 + 0 =
SPONSORED
QUESTION

SPONSORED
EMSDN