tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "McCracken, Denise" <Denise.McCracken@misyshealthcare.com>
Subject: SUMMARY: User timeouts
Date: Thu, 10 Apr 2003 12:47:12 -0700	[thread overview]
Message-ID: <21C552CF85C64D4A891D47E7A33274A8048E2EBF@EXBRDY.sunquest.com> (raw)


Thanks fo Jay Wren, Jim Fitzmaurice, Michael Deacy, Bruce Hines, David
DeWolfe and anyone i've missed.

The solution is, for ksh, set the enviro TMOUT=n where n is in seconds.
For /sbin/sh, the variable is TIMEOUT and is in minutes.

-Denise

-----Original Message-----
From: Jean-François Blanchet [mailto:Jfblanchet@dgeq.qc.ca]
Sent: Monday, March 31, 2003 12:11 PM
To: tru64-unix-managers@ornl.gov
Subject: SUMMARY: script for replacing Null character in files


My question:

   I want to find and replace ascii character 00 by blank in file.

   I have 125 files to do.

   Can you give me a solution  with unix utilities?

Solutions:

A lot of good responses,
but I have use this one:


perl -pi -e 's/\x00/ /g;' filename

Using wildcards in the filename is valid, too.

------------------------------------------------------------------
for i in <filelist>; do tr "\0" " " <$i >$i.nonul; cp $i.nonul $i; rm -f
$i.nonul; done;

------------------------------------------------------------------
foreach x (*)
  echo $x
  cat $x | tr '\000' ' ' > ${x}.NEW
  mv $x.NEW $x
end
------------------------------------------------------------------
/*
    chnulltoblank.c
    P. Farrell, Jan 15, 2003

    Program to read std input, translate all null characters
(\000) to blanks, and write to standard output.

    Compile with:
        cc -o chnulltoblank chnulltoblank.c

    Use like this:
        chnulltoblank < inputfile > outputfile
*/
#include <stdio.h>

main()
{
   char ch = '\0';
   char null = '\0';
   char blank = ' ';

   while((ch = getc(stdin)) != EOF) {

      if( ch != null )
    putc(ch,stdout);
      else
    putc(blank,stdout);

   }  /* end of read loop */

   fclose(stdout);  /* so next program in pipe sees EOF properly */
}

----------------------------------------------------------------------------
------------


   





                 reply	other threads:[~2003-04-10 19:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox