This is an automation of a command to SQLPlus 12c on Linux from Windows 18_3 version on PowerShell 5.1 with Microsoft modules loaded.
I need to clean out the whitespace of the string to input wildcard data on an automation Select script (the final script will find a missing TIFF image and reinsert it).
I am UNABLE to remove the white space before the tee
.
The latest attempts are in the post but I have tried Trim
, Split
, Replace
, Remove
, Substring
, >>
, Write-Host -NoNewline
,... I am SO close.
When I Write-Host -NoNewline
I succeeded in removing the CRLF but not so as I can Tee
, Write-Out
, or Out-File
the content that way.
#Add-Type -AssemblyName System.Data.OracleClient
$filefolder = "C:\EMSCadre\iGateway\clint\Input_Images\"
$Files = Get-ChildItem $FileFolder -Name -File
$longname = $Files.Get(2)
$shortname = $longname.Replace("_tiff","").Replace("cns","").Substring(9).Split('".tif"')
echo "select LD_CASE_NUMBER FROM LOG_data where ld_message_3 like %$shortname%" |
tee -Verbose c:\scripts\input\lockedout_test.sql
type c:\scripts\input\lockedout_test.sql
#Failed attempts
#echo "select LD_CASE_NUMBER FROM LOG_data where ld_message_3 like %($shortname1.TrimEnd('_',"")%" |
# tee -Verbose c:\scripts\input\lockedout_test.sql
Latest Results showing Whitespaces before last %
:
select LD_CASE_NUMBER FROM LOG_data where ld_message_3 like %100838953_180130001 % select LD_CASE_NUMBER FROM LOG_data where ld_message_3 like %100838953_180130001 %
Details to help troubleshoot:
PS C:\scripts> $Files 2823910000.tif 2823910002.tif cns20180827_100838953_180130001_tiff.tif exposureworks-dynamic-range-test-f16-graded-TIFF-RGB-parade.jpg PS C:\scripts> $shortname 100838953_180130001