将字符串操作的输出写入Azure Data Lake Store Item [英] Writing output of String manipulation to Azure Data lake Store Item

查看:111
本文介绍了将字符串操作的输出写入Azure Data Lake Store Item的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将Get-AzureRmDataLakeStoreItemContent输出的String操作的输出写入变量并尝试将其以变量形式传递给New-AzureRmDataLakeStoreItem时,我收到错误消息"New-AzureRmDataLakeStoreItem:传入的无效内容.仅字节[]和字符串内容受支持."

When I try to write an output of a String manipulation of Get-AzureRmDataLakeStoreItemContent output to a variable and try to pass it in a variable to New-AzureRmDataLakeStoreItem i am getting error "New-AzureRmDataLakeStoreItem : Invalid content passed in. Only byte[] and string content is supported."

我验证了Get-command的输出是一个对象,但我不明白为什么我无法传递它.我不确定是否需要更多像Hashtable这样的转换来存储到Azure Data Lake存储中的输出中.还是编码问题.请帮助破译此错误

I verified that the output of Get-command is an Object but I dont understand why i am not able to pass it. I am not sure whether I need some more transformation like a Hashtable to store into an output in Azure Data lake store. Or is it an Encoding problem. Please help in deciphering this error

这是代码,我还附有错误的屏幕截图. 原始输入

Here is the code and i am also attaching a screenshot of the error. Original input

1|2|3|a,b,
3|4|5|d,h,

字符串操作的输出

1|2|3|a,b
3|4|5|d,h

$data=((Get-AzureRmDataLakeStoreItemContent -Account $accountName -Path $myrootdir/V_FQP_ITC_11_VEHICLE/test.csv).ToString() -split("`r")).Trim() | ForEach-Object {$_.TrimEnd(",")}
New-AzureRmDataLakeStoreItem  -Account $accountName -path $myrootdir/test_output.txt -Value $data 

推荐答案

似乎您需要添加$data"",它对我有用.

Seems you need to add a "" of $data, it works on my side.

New-AzureRmDataLakeStoreItem  -Account "joydatalake1" -path "/sss/test_output.txt" -Value "$data"

这篇关于将字符串操作的输出写入Azure Data Lake Store Item的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆