Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to delete a character ?

$
0
0

Hi all,

 

I know how to delete a character but I try first to understand why it's appearing in order to decide the way to delete it. I do not catch it yet. Here is the problem:

I create a file with some comments I add for each line. On one of the lines I have the following variable/statement:

  • Add-Content -Path $sFullPath -Value "JobID=$JobID-$i"

The result is something like this:

  • JobID=20140418111744_-1 => at the end it should be _1 AND NOT _-1

 

The variables related to the statement are as following:

  • $TimeID = Get-Date -Format yyyyMMddHHmmss
    $dateStamp = Get-Date -f yyyyMMdd
  • $FOTD = "C:\NG_auto_project\$($dateStamp)_GetFasta.txt"
  • $i = ""
    $JobID = $TimeID + "_" + "$i"

I try a foreach function and do a replace function but it places me an underscore elsewhere.

Any idea?


Viewing all articles
Browse latest Browse all 6937

Trending Articles