Home » Infrastructure » Unix » Creating file using UNIX K-Shell Scripts.
Creating file using UNIX K-Shell Scripts. [message #242171] Thu, 31 May 2007 19:19 Go to next message
bsraj
Messages: 4
Registered: June 2004
Junior Member
Hi All,

Please help me in creating files through K-shell scripts.
I am having one file in this format.
OWNER.TABLE_NAME
OWNER.TABLE_NAME1
OWNER1.TABLE_NAME
OWNER1.TABLE_NAME1

I want to read the above file and create new file through k shell script.
The new file should looks like this.
SCHEMAS=OWNER,OWNER1
INCLUDE=TABLE:"IN ('TABLE_NAME','TABLE_NAME1')"

Please let me know there are any questions.

Thanks,
bsraj.
Re: Creating file using UNIX K-Shell Scripts. [message #242178 is a reply to message #242171] Thu, 31 May 2007 22:35 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Just use vi
It works for me
Re: Creating file using UNIX K-Shell Scripts. [message #242367 is a reply to message #242178] Fri, 01 June 2007 12:30 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Thanks to anacedent for yet another useful comment...

here's a starting point:
dev>>cat tst.txt
OWNER.TABLE_NAME
OWNER.TABLE_NAME1
OWNER1.TABLE_NAME
OWNER1.TABLE_NAME1
dev>>awk -F. '{ print $1 }' tst.txt | sort | uniq | xargs | tr " " ","                
OWNER,OWNER1
dev>>awk -F. '{ print "'"\'"'"$2"'"\'"'" }' tst.txt | sort | uniq | xargs | tr " " ","
'TABLE_NAME1','TABLE_NAME'

Re: Creating file using UNIX K-Shell Scripts. [message #242447 is a reply to message #242171] Sat, 02 June 2007 03:22 Go to previous message
nmacdannald
Messages: 460
Registered: July 2005
Location: Stockton, California - US...
Senior Member
###
#
# Inform operator what job they have requested
# Ask if they wish to continue
#
echo " "
echo "*****"
echo Starting hot backup of S2000 database
echo "Continue? (Y/N)"
read answer
echo " "
if [[ "$answer" = [Yy]* ]]
then
df -k /u26
echo `date`
thedir=`pwd`
echo " "
echo Enter password for S2000 ORADBA
sttyops=`stty -g`
stty -echo
echo "Password: "\\c
read password
echo " "
stty $sttyops
#
# Start the hot backup job
#
sqlplus ORADBA/$password << EOF
@$thedir/hotbackup_start
exit
EOF
Previous Topic: Unix port information
Next Topic: How to pass the password for SCP/SFTP shell scripts in batch mode
Goto Forum:
  


Current Time: Wed Dec 11 22:31:05 CST 2024