![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vi command -output garbage char in HP-UX | jambesh | Shell Programming and Scripting | 3 | 08-30-2007 06:07 AM |
| Removing Null data in output | liketheshell | Shell Programming and Scripting | 2 | 08-13-2007 04:59 PM |
| Removing first line from output | Krrishv | Shell Programming and Scripting | 3 | 01-09-2007 06:20 AM |
| Script to Remove Garbage Character | Eddie_The_Head | Shell Programming and Scripting | 4 | 03-28-2006 05:09 AM |
| Garbage characters in display | Haleja001 | UNIX for Dummies Questions & Answers | 0 | 09-21-2005 09:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Removing Garbage output
I am using following code to read myfile.ddl line by line. But the thing is it is printing lot of garbage which are the names of the files and directories in which myfile.ddl is present. Kindly refine the code so that only myfile.ddl contents are only read
LOGFILE="logfile.txt" DDLFILE="myfile.ddl" exec 3<&0 exec 0<$DDLFILE while read line do SQL=$line executeSQLToFile ${LOGFILE} -x ${SQL} done exec 0<&3 |
|
||||
|
I used the same script and i have removed the function and have just printed the SQL in the logfile. It is working as desired.
Code:
#!/bin/ksh
LOGFILE="logfile.txt"
DDLFILE="myfile.ddl"
exec 3<&0
exec 0<$DDLFILE
while read line
do
SQL=$line
echo ${SQL} >> $LOGFILE
done
exec 0<&3
Code:
+ LOGFILE=logfile.txt + DDLFILE=myfile.ddl + exec + 3<& 0 + exec + 0< myfile.ddl + read line + SQL=test1 + echo test1 + 1>> logfile.txt + read line + SQL=test2 + echo test2 + 1>> logfile.txt + read line + SQL=test3 + echo test3 + 1>> logfile.txt + read line + exec + 0<& 3 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|