Application & System: Development / Integration / Orchestration
Bash – Trim/Remove White Space
Posted on
By David Kittell
sed 's/^[ \t]*//'
sed 's/[ \t]*$//'
sed 's/^[ \t]*//;s/[ \t]*$//'
Originally Posted on May 4, 2017 Last Updated on August 25, 2019
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.
The following code is for Debian 9 Stretch but should work on older Debian with minor changes Originally Posted on January 18, 2018Last Updated on January 31, 2019 All information on this site is shared with the intention to help. Before any source code or program is ran on a…
Sometimes you have to pull a date from Oracle in a cleaner format, this is one way to achieve the format you want. // Convert the Oracle date 19000101 to 01-01-1900 public string OracleCleanDate(string strDate) { if (strDate.Length == 8) { string strYear, strMonth, strDay; strYear = strDate.Substring(0, 4); strMonth…
function Set-ComputerName { param( [switch]$help, [string]$originalPCName=$(read-host "Please specify the current name of the computer"), [string]$computerName=$(read-host "Please specify the new name of the computer")) $usage = "set-ComputerName -originalPCname CurrentName -computername AnewName" if ($help) {Write-Host $usage;break} $computer = Get-WmiObject Win32_ComputerSystem -OriginalPCname OriginalName -computername $originalPCName $computer.Rename($computerName) } Reference: http://poshcode.org/6036 All information on this…