Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 636869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:33:42+00:00 2026-05-13T20:33:42+00:00

I am trying to get the character count for each row in a text

  • 0

I am trying to get the character count for each row in a text doc. The contents of my text doc are:

1
15
69
124
300

I’ve been trying variants of the PS script:

get-content c:\serverlist.txt | foreach-object {measure-object -character}

But the best I can get returned is:

Lines     Words     Characters   Property
——-     ——–     ————–   ———–
                                            0
                                            0
                                            0
                                            0
                                            0

Not sure what I’m missing here, but any help would be appreciated!

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:33:42+00:00Added an answer on May 13, 2026 at 8:33 pm

    You have to pipe directly into Measure-Object:

    Get-Content c:\serverlist.txt | Measure-Object -Character
    

    Otherwise you’d have to do either

    | ForEach-Object { $_ | Measure-Object -Character }
    

    which would be a bit of weird use of the pipeline or

    | ForEach-Object { Measure-Object -Character -InputObject $_ }
    

    which would be just about the same as the variant above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a character count of an EditText. I've looked into different
I'm trying to get the character count of a particular line of a multi-line
i am currently trying to assign each character that i get from a file
I'm trying to get the content between a double-quote to count as one token
I'm trying to get character data from www.wowarmory.com using PHP and cURL. The code
Creating a simple RPG game, first time using XNA. Trying to get my character
So i am trying get 2 div-containers which both should contain centered text (Both
Trying to get a wildcard search to pick up on any text in org_name
trying to get same string on tooltip as is in the Text e.g. Text=<%#
I wrote a perl script to count the occurrences of a character in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.