How can I seperate one string into multiple strings using PowerShell?

New to PowerShell...how can I read/separate parts of a file name? For instance if I have a file name like "part1_part2_part3_part4.xls", how to separate this file name to four different parts? So I basically want to go from that file name,
to four different strings like part1, part2, part3, and part4...as four separate strings. How can I get this done in PowerShell?
Thanks

You can try something like this
PS> (Get-ChildItem part1_part2_part3_part4.xls).BaseName.Split('_')

Similar Messages

  • How can I separate one column into multiple column?

    How can I separate one column into multiple column?
    This is what I have:
    BUYER_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE
    0001 PHONE_NUMBER 555-555-0001
    0001 EMAIL [email protected]
    0001 CURRENCY USD
    0002 PHONE_NUMBER 555-555-0002
    0002 EMAIL [email protected]
    0002 CURRENCY USD
    0003 PHONE_NUMBER 555-555-0003
    0003 EMAIL [email protected]
    0003 CURRENCY CAD
    This is what I would like to have:
    BUYER_ID PHONE_NUMBER EMAIL CURRENCY
    0001 555-555-0001 [email protected] USD
    0002 555-555-0002 [email protected] USD
    0003 555-555-0003 [email protected] CAD
    Any help would be greatly appreciated.

    This is another solution. Suppose your actual table's name is test(which has the redundant data). create a table like this:
    CREATE TABLE test2 (BUYER_ID number(10),PHONE_NUMBER varchar2(50),EMAIL varchar2(50),CURRENCY varchar2(50));
    then you will type this procedure:
    declare
    phone_number_v varchar2(50);
    EMAIL_v varchar2(50);
    CURRENCY_v varchar2(50);
    cursor my_test is select * from test;
    begin
    for my_test_curs in my_test loop
    select ATTRIBUTE_VALUE INTO phone_number_v from test
    where person_id=my_test_curs.person_id
    and attribute_name ='PHONE_NUMBER';
    select ATTRIBUTE_VALUE INTO EMAIL_v from test
    where person_id=my_test_curs.person_id
    and attribute_name ='EMAIL';
    select ATTRIBUTE_VALUE INTO CURRENCY_v from test
    where person_id=my_test_curs.person_id
    and attribute_name ='CURRENCY';
    INSERT INTO test2
    VALUES (my_test_curs.person_id,phone_number_v,EMAIL_v,CURRENCY_v);
    END LOOP;
    END;
    Then you will create your final table like this:
    create table final_table as select * from test2 where 1=2;
    After that write this code:
    INSERT ALL
    into final_table
    SELECT DISTINCT(BUYER_ID),PHONE_NUMBER,EMAIL,CURRENCY
    FROM TEST2;
    If you have a huge amount of data in your original table this solution may take a long time to do what you need.

  • How can I Make one column into Multiple columns

    Id
    SCM-01-015
    SCM-01-020
    SFA-02-021
    SFC-02-042
    STB-03-035
    STP-04-167
    SVF-06-150
    I want the output like this
    Id 01 02 03 04 06
    SCM-01-015 5
    SCM-01-020 10
    SFA-02-021 15
    SFC-02-042 15
    STB-03-035 20
    STP-04-167 50
    SVF-06-150 5
    thank you in advance

    Hi,
    801668 wrote:
    Id
    SCM-01-015
    SCM-01-020
    SFA-02-021
    SFC-02-042
    STB-03-035
    STP-04-167
    SVF-06-150
    I want the output like this
    Id 01 02 03 04 06
    SCM-01-015 5
    SCM-01-020 10
    SFA-02-021 15
    SFC-02-042 15
    STB-03-035 20
    STP-04-167 50
    SVF-06-150 5
    thank you in advanceWhenever you post formatted text (such as query output) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after formatted text, to preserve spacing.
    Do you want output something like this, which is from the scott.emp table?ENAME ANALYST CLERK MANAGER PRESIDENT SALESMAN
    ALLEN 1600
    JONES 2975
    FORD 3000
    CLARK 2450
    MILLER 1300
    SMITH 800
    WARD 1250
    MARTIN 1250
    SCOTT 3000
    TURNER 1500
    ADAMS 1100
    BLAKE 2850
    KING 5000
    JAMES 950
    (ALLEN is a SALESMAN, JONES is a MANAGER, ..., JAMES is a CLERK.)
    If so, do a pivot, somehting like this:SELECT     ename
    ,     MIN (CASE WHEN job = 'ANALYST' THEN sal END)     AS analyst
    ,     MIN (CASE WHEN job = 'CLERK' THEN sal END)     AS clerk
    ,     MIN (CASE WHEN job = 'MANAGER' THEN sal END)     AS manager
    ,     MIN (CASE WHEN job = 'PRESIDENT' THEN sal END)     AS president
    ,     MIN (CASE WHEN job = 'SALESMAN' THEN sal END)     AS salesman
    FROM     scott.emp
    GROUP BY ename
    Always say which version of Oracle you're using.
    The query above will work in Oracle 8.1 or higher, but starting in Oracle 11 there's a better way:  SELECT ... PIVOT.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can i put one scene into JPanel of the swing?

    how can i put one scene into JPanel of the swing?

    980571 wrote:
    ty for the information but i have a problen with JFXpanel when i try to into a panel it doesnt display insideSorry to hear that. If you want assistance with the code, feel free to post the relevant parts of it. Make sure to use \ tags when you do.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can i create  excel sheet with multiple tabs using utl file?

    how can i create excel sheet with multiple tabs using utl file?
    any one help me?

    Jaggy,
    I gave you the most suitable answer on your own thread yesterday
    Re: How to Generating Excel workbook with multiple worksheets

  • How can I send a message to multiple contacts using "groups".

    How can I send a message to multiple contacts using "groups".
    It was easy on my sony ericssonn....do i need to download an app?

    There is no group send option like you are looking for.
    To send to a group you have to pick each person you want to send to and send as a group that way. Then don't delete that SMS thread and you can reuse it again later.
    As for an app, well SMS works via your carrier and the OS, not something an App can do unless the app send the data to them (a third party) and then they relay it to the carrier. Do you really want to be sending your SMS to some 3rd party first?

  • How do I separate a PDF into multiple PDFs using Adobe PDF Pack?

    How do I separate a pdf into multiple pdfs using AdobePack?
    [Title edited to reflect actual product name... Mod]

    I do not find "AdobePack" when I look at the list of forums https://forums.adobe.com/welcome
    What is the exact name of the program you are using... Acrobat, or are you using the online version at Acrobat.com?
    ADDED... found Adobe PDF Pack (read only) so will move this message

  • How can I assign an icon to a folder using Powershell?

    How can I assign an icon to a folder using Powershell?

    I'm trying to make a script that goes through a folder recursively, checks for every folder if it's name is "template", and if so it changes the icon of that folder to an icon
    I chose.
    I searched for an answer here, and I've only managed to find a way to assign an icon to a shortcut, but not to an existing file.
    Thanks in advance (:

  • During import, how to auto split one project into multiple albums based on date?

    I believe I've done enough aperture reserach to get all my terminology right, so here goes...
    I've created a file structure within the aperture inspector the the tune of: 
    Year [folder], Type of event (Occasion, special occasion, holiday, vacation) [folder], Project (Wedding), Album (i.e. Day 1, Day 2 or Pre wedding week, event, honeymoon).
    I also have entire months with 7 or 8 pictures each day, that are of the same type/project (random dog pictures) but are distinctly different days (albums - day in park, in bed at night, watching movie). 
    My question is, can I import one project with multiple albums already created based on the date they're taken.  As I can see it, all I can do is split individual projects automatically by date.  But what if one project is over one month, but has multiple distinct days that would be ideal for albums?  One more example.  We did a trip to San Fran.  One day was touring the city, one day was a concert, another day was touring the city.  All one project, but 3 different albums (in my mind).  I had to import as one project, then separately go in and make albums.  I would like that done automatically.
    My suspicion is that I can not natively do this within aperture, and that I would need something called an "applescript."  I haven't done any reserach into that area, so if that's the case and you know where I can find a script that would do this, I'd appreciate the help. 
    Sorry for the wordiness, just wanted to be clear.  Thanks for any and all help!

    Hi,
    You need to create a new requirement in tcode VOFM for that, together with your ABAP consultant. This requirement will be used in copy contol.
    http://saptechsolutions.com/pdf/VOFMCopyRequirementRoutines.pdf
    MdZ

  • How can I break one track into several tracks

    Hello all,
    Im new to Mac and garageband, My problem is when i spin a full set of lets say 2 hours into garage band as 1 track, how can I go back and break that 1 track into several tracks so when I make a cd people can change from track to track instead of listening to one track all the way through.
    Thanks in Advance

    Ok now that I chose the region how would I export it?
    Just select "export".
    And Also Do I have to export each track one by one to itunes?
    Since you want to burn a CD, you need several sound files, and GB only exports one file at a time.

  • How can i convert JMS TextMessage into a String

    Please tell me,How can i convert A JMS TextMessage into a String

    http://java.sun.com/javaee/5/docs/api/javax/jms/TextMessage.html#getText()

  • How can I copy one sheet into another spreadsheet or another file?

    I am trying to copy a sheet from one file into another.  Is that possible in Numbers?

    Open both documents.
    Click on the sheet icon of the sheet you want to Copy fom the Source document. Copy
    Switch to the second document.
    Click on the icon of one of the Sheets on that document. Paste.
    The copied sheet (and its contents) will be pasted into the list immediately below the selected sheet.
    Regards,
    Barry

  • How can you develop photo galleries with multiple pages using the web module?

    Going through the web module I can see there are many options for developing a web page with a single collection of photos.  How can you develop a web site with multiple pages containing different categories of photos using the Lightroom web module?

    This thread will give you several ideas.
    Re: How do you embed a gallery into an existing website?

  • How can I integrate add-ons into a PDF (Use Adobe Acrobat (in Firefox), such as Babylon English Dictionary?

    How can I integrate the Fox add-ons into a PDF (Use Adobe Acrobat (in Firefox), such as Babylon English Dictionary? Many PDF do support my add-ons. BTW, the PDF in question is one that I have uploaded to my web site.

    Babylon would need to support Adobe Acrobat for that to happen.

  • How can I hide "Taxonomy Catch All Column" without using PowerShell?

    After having moved some files around, I find that my view and edit properties forms include the field "Taxonomy Catch All Column" and the field IDs which are just going to be confusing gobbledegook to my end users.
    I can't seem to find a way to get rid of it. I can't delete it and I can't see where to hide it. Searches only seem to turn up PowerShell script solutions, and I can't use PowerShell.
    It's SharePoint 2010 Server, I'm a site admin and I can use SharePoint Designer, but not powershell, no server access, no central admin access.
    Can anyone help please?

    Hi,
    For your issue, it seems to be related to use Content & Structure. 
    If you choose to move content that contains managed metadata columns (or presumably enterprise keywords), the Taxonomy Catch All column shows up after you use the "Content and structure" tool. It shows up as a column in the library and is visible
    in "Edit Properties" on every document.
    Why are you can’t use power shell? It is convenient to solve your problem with power shell.
    Here is a similar post, you can use as a reference:
    https://social.msdn.microsoft.com/Forums/en-US/896cea1d-dc40-47f1-80f4-7a01f2d23fd9/what-is-the-significance-of-taxonomy-catch-all-column-lookup-column
    http://blogs.c5insight.com/Home/tabid/40/entryid/385/Why-Do-Hidden-Taxonomy-Catch-All-Columns-Become-Visible.aspx
    Besides, here is an article, you can have a look at:
    http://www.andrewconnell.com/sharepoint-2010-managed-metadata-in-depth-look-into-the-taxonomy-parts
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

Maybe you are looking for

  • In one of our Project commitment cost still showing which has GI & GR done

    we have one Project wherein the commitment cost is still showing for the PO which has a Invoice and GRN is done. I have tried re-structuring the Project using  CJEN. Can anybody help me on this? Thanks in advance Sanjay

  • GUI_DOWNLOAD IN BDC

    Hi experts,                 i am using tcode xd02 in bdc for recording.i want to download the data present in xd02 into a flatfile.is it possible.if it is possible send me a sample coding or give me some points......i will must reward the points once

  • Insufficient Privileges while generating database

    Hello, I have created my ER diagram and I can see the entities, attributes, relations etc in the object Navigator. But, when I tried to run the database design transformer to generate my tables, I am getting insufficient privileges error and none of

  • Elements 12 Photo Editor stopped working

    I recently purchased a brand new HP with Windows 8.  I downloaded PS Elements 12 from Amazon last month and a few weeks in, Photoshop Editor stoped working.  I ended up uninstalling it then reinstalling and it worked great for a few days before the E

  • Loop through Timer is ok, but then, how to append string?

    Hi, reading thorugh this forum, I was able to create a loop cycle via a timer (http://social.technet.microsoft.com/Forums/en-US/a1d160ba-a7d6-4c5c-aa2a-f724990a3b11/add-repeating-entry-to-collection?forum=projectsiena). Now, I would be ready to colle