tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: ksh script question
@ 1999-02-23 14:22 SIMEONE, Allan J.
  0 siblings, 0 replies; 3+ messages in thread
From: SIMEONE, Allan J. @ 1999-02-23 14:22 UTC (permalink / raw)
  To: tru64-unix-managers

Just like that, I received about 15 answers!  I knew it was
an easy one.   Thanks for the quick answers and too many to
list here individually.

Here are some examples:

cat file.in | awk '{ print $1 " " tolower($1) }' >file.out

_____________

touch output
cat input | while read line
do
	echo $line `echo $line | tr '[A-Z]' '[a-z]'` >> output
done

_______________

cp file temp
dd if=temp conv=lcase of=temp2
paste temp temp2 > temp3



I only tried the first example and it worked fine.

original question follows.

thanks!
Allan


> ----------
> From: 	SIMEONE, Allan J.
> Sent: 	Tuesday, February 23, 1999 9:03 AM
> To: 	'Tru64-unix-managers@ornl.gov'
> Subject: 	ksh script question
> 
> Hi All,
> 
> Ksh script question.
> 
> I have a file with the following (for example:)
> 
> ABC123X
> DEF123Z
> GHI456A
> 
> I need to get an output file with the following...
> 
> ABC123X  abc123x
> DEF123Z  def123z
> GHI456a   ghi456a
> 
> Basically change the line to lower case but have both in the file.
> There would be about 100 lines in the file.
> 
> Can anyone send me an example on how to do this?
> 
> thanks,
> Allan
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread
* SUMMARY: ksh script question
@ 1999-02-23 17:33 David Komanek
  0 siblings, 0 replies; 3+ messages in thread
From: David Komanek @ 1999-02-23 17:33 UTC (permalink / raw)
  To: tru64-unix-managers


Here is an example how to do it : \t character in echo command gives the
TAB like an separator.

#!/bin/ksh
while read buffer
do
        echo "$buffer\t`echo "$buffer" \
          | tr -ds '\n' '' | tr '[:upper:]' '[:lower:]' `"
done < $1




David Komanek



> I have a file with the following (for example:)
> 
> ABC123X
> DEF123Z
> GHI456A
> 
> I need to get an output file with the following...
> 
> ABC123X  abc123x
> DEF123Z  def123z
> GHI456a   ghi456a
> 
> Basically change the line to lower case but have both in the file.
> There would be about 100 lines in the file.
> 
> Can anyone send me an example on how to do this?
> 
> thanks,
> Allan
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread
* SUMMARY: ksh script question
@ 2008-03-19  0:46 Brehl, Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Brehl, Blake @ 2008-03-19  0:46 UTC (permalink / raw)
  To: tru64-unix-managers

Found a conditional in the ksh man pages.  
 
#!/bin/ksh
LOCALDRV=/home/users/mfg/xxbusint1; export LOCALDRV
NFSDRV=/home/whlzdev/xxbusint1; export NFSDRV
 
cd $LOCALDRV

if [ -d $NFSDRV]
    then
        cd $NFSDRV
    else
        echo "failover mode, no NFS, writing locally"
fi
exec /someexecutable


Best Regards,	Blake

________________________________

From: Brehl, Blake 
Sent: Tuesday, March 18, 2008 4:00 PM
To: Tru64 Mailing List (tru64-unix-managers@ornl.gov)
Subject: ksh script question


Hello Admins,
 
trying to have a script that will write to a NFS mounted drive, but will
write to a local drive if the NFS mounted one is not available.  Trying
this with a cd to the local drive 1st, then a cd to the NFS mounted one
2nd.
 
#!/bin/ksh
LOCALDRV=/home/users/mfg/xxbusint1; export LOCALDRV
NFSDRV=/home/whlzdev/xxbusint1; export NFSDRV
 
cd $LOCALDRV; sleep 1
cd $NFSDRV
 
exec /someexecutable
 
When either the Local or NFS drives aren't there, the 'cd' command
returns an error value of >0 and exits the shell script.
 
Any suggestions?
 
 
Blake Brehl
Sys Admin/DBA
Anritsu Company United States
Morgan Hill, CA
blake.brehl@anritsu.com
 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-19  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-02-23 14:22 SUMMARY: ksh script question SIMEONE, Allan J.
  -- strict thread matches above, loose matches on Subject: below --
1999-02-23 17:33 David Komanek
2008-03-19  0:46 Brehl, Blake

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