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

Rename multiple files based on their content

$
0
0

I am very much novice on powershell but I am trying to find(learn) a solution in powershell to rename several text files based on their content:

For eg:

I have a file with content in first line something like: CAT35;BAT46:A;RABBIT36:B;DOG32:C;SN00014,

I need to rename the file based on its content from 2nd (only alphanumeric: BAT45 from above example) and anything on last column before comma(SN00014 from above example) in its first line. So new name of the file should be BAT45SN000014.txt. (probably I need to use regex here).

Thank you very much for any help,

JBR


Viewing all articles
Browse latest Browse all 6937

Trending Articles