Jump to content
Software FX Community

out-map: Inputting data without using import-csv


Recommended Posts

Perhaps something useful for others...

I asked a question in the forum here, and the microsoft.public.windows.powershell newsgroup about whether the import-csv output could be copied using some other cmdlet like write-output...  Yes it can!

PS C:\> gc country.csvCountry,PointsU.S.A.,20Canada,10PS C:\> import-csv country.csv

Country Points------- ------U.S.A.   20Canada   10

PS C:\> "U.S.A.,20","Canada,10"|select-object @{e={$_.split(',')[0]};n='Country'},@{e={$_.split(',')[1]};n='Points'}

Country Points------- ------U.S.A.   20Canada   10

So, instead of using import-csv to pipe to out-map, one can use write-output or as illustrated above.

I haven't tried it yet, but that might keep me from having to write temporary files in some scripts of mine.  I might also be able to throw in scriptblocks into the data piped to out-map.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...