rimmena
asked on
Stripping out 0's from a file
I have a text file file with multiple entries in the following format:
TEST|1111110000|1111111111 1111| |\\server-01.home.org\imag es\small_i mages\IMG_ 000\000000 005983592. tif|HOME|7 8787878
TEST|1111110000|1111111111 1111| |\\server-01.home.org\imag es\small_i mages\IMG_ 000\000009 995983592. tif|HOME|7 8787878
My issue is that I need to strip out the leading 0's from the .tif file name throughout the file, but the file name does not always have the
same amount of leading 0's. Looking for a script that can do this.
TEST|1111110000|1111111111
TEST|1111110000|1111111111
My issue is that I need to strip out the leading 0's from the .tif file name throughout the file, but the file name does not always have the
same amount of leading 0's. Looking for a script that can do this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, replace the 2nd line to:
$_ -replace "^0+(?=\d+\.tif)",""
ASKER
Now it's back to leaving all the zero's
Sorry again, this is good now (I hope :-) )
$_ -replace "(?<=\\)0+(?=\d+\.tif)",""
ASKER
That is fantastic thanks for your help and timely response with this, much appreciated.
Can you advise on a good book to learn powershell, I have some VB Script experience ?
Thanks Again
Can you advise on a good book to learn powershell, I have some VB Script experience ?
Thanks Again
Read this one first: http://manning.com/payette2/
Maybe you'll not understand all at the first time, but go through, try the examples and then read it again from the beginning. The second time you'll understand all.
Then read this, maybe not from the beginning till the end, but read the topics you are interested in:
http://oreilly.com/catalog/9780596801519/
Maybe you'll not understand all at the first time, but go through, try the examples and then read it again from the beginning. The second time you'll understand all.
Then read this, maybe not from the beginning till the end, but read the topics you are interested in:
http://oreilly.com/catalog/9780596801519/
ASKER
Thanks
ASKER
So 000000000005506969 outputs to 556969