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 9228117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:14:45+00:00 2026-06-18T05:14:45+00:00

I have problem with data in the file. Data in the text file looks

  • 0

I have problem with data in the file. Data in the text file looks like:

ADSE64E...Mobile phone.....................                           
EDW8......Unknown item.....................                           
CAR12.....Peugeot 206 with red colour......            
GJ........Parker model 2...................                         
Por887W8..Black coffe from Peru............  

The dots represents blank spaces. First column is Product_Code (long 1-10) and second (long 1-255) is Description. All i need is:

ADSE64E;Mobile phone                           
EDW8;Unknown item                          
CAR12;Peugeot 206 with red colour           
GJ;Parker model 2.                         
Por887W8;Black coffe from Peru 

My solusions are:

  1. First column get to the variable (and same process with second column) and merge both variables to one.. But i dont know how..

    $variabletxt = get-content C:\Product.txt

    $firstcolumn = $variablestxt.substring(1,10)

    $secondcolumn = $variablestxt.substring(10)

    $final = ???

  2. Replace blank spaces but problem is that product_code may by long 1-10.

Have you any suggestion how I resolve this problem?

  • 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-06-18T05:14:46+00:00Added an answer on June 18, 2026 at 5:14 am

    split your sting then replace “more than one space” with nothing :

    gc file.txt |%{
    ($_.substring(0,9)  -replace "[ ]{2,}","")+";"+($_.substring(10,254)  -replace "[ ]{2,}","")+";"
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file that looks like this: i 3755 i 3633 i
I have a very large text file that contains lines of data like: ('#DownWithAssad',
The problem I have a tab delimited input file that looks like so: Variable
I have a text file that looks something like this where the first column
I have problem with this code: file = tempfile.TemporaryFile(mode='wrb') file.write(base64.b64decode(data)) file.flush() os.fsync(file) # file.seek(0)
I have one problem , I want to get some data from XML file
i have problem.. for(a=1;a<10;a++){ $(.div).append(<div id=+a+></div>) $.ajax({ url: file.php, data: a=+a, type: POST, async:
i am getting problem as i have some data in a database tabel file
I have application reads in data from text file. Recently I realized that I
I do have some text(template), which looks like Hello @FirstName, Welcome to @Address. The

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.