3

I am looking to get to know about how many words and characters are there in a particular Content Item using Sitecore powershell. I know how to do it for a file. for ex:

Get-Content C:\testfile.txt | Measure-Object –Line -Word

but unable to do it for a content item. Any suggestions.

4

This would do you count for the text field for the home item.

$item = Get-Item -Path "master:\content\home"
$measure =  $item["text"] | Measure-Object –Line -Word
echo $measure
  • Thanks for the help @chris but I am getting an error while executing this script. Refer screen shot prnt.sc/opfgoi. – shobhit Aug 7 at 8:05
  • And that is just from running my code? It runs fine for me. Can you post your code of different. – Chris Auer Aug 7 at 11:46
  • Yes, that is just by running your code. i have just changed path value in it. rest remains the same. – shobhit Aug 13 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.