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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:38:00+00:00 2026-06-02T15:38:00+00:00

I have a file (ratings.lst) downloaded from IMDB Interfaces. The content appears to be

  • 0

I have a file (ratings.lst) downloaded from IMDB Interfaces. The content appears to be in in the following format :-

Distribution   Votes      Rating  Title
0000001222     297339     8.4     Reservoir Dogs (1992)
0000001223     64504      8.4     The Third Man (1949)
0000000115     48173      8.4     Jodaeiye Nader az Simin (2011)
0000001232     324564     8.4     The Prestige (2006)
0000001222     301527     8.4     The Green Mile (1999)

My aim is to convert this file into a CSV file (comma separated) with the following desired result (example for 1 line) :

Distribution   Votes      Rating  Title
0000001222,    301527,    8.4,    The Green Mile (1999)

I am using textpad and it supports regex based search and replace. I’m not sure what type of regex is needed to achieve the above desired results. Can somebody please help me on this. Thanks in advance.

  • 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-02T15:38:02+00:00Added an answer on June 2, 2026 at 3:38 pm

    The other regular expressions are somewhat overcomplicated. Because whitespace is guaranteed not to appear in the first three columns, you don’t have to do a fancy match – “three columns of anything separated by whitepace” will do.

    Try replacing ^(.+?)\s+(.+?)\s+(.+?)\s+(.+?)$ with \1,\2,\3,"\4" giving the following output (using Notepad++)

    Distribution,Votes,Rating,"Title"
    0000001222,297339,8.4,"Reservoir Dogs (1992)"
    0000001223,64504,8.4,"The Third Man (1949)"
    0000000115,48173,8.4,"Jodaeiye Nader az Simin (2011)"
    0000001232,324564,8.4,"The Prestige (2006)"
    0000001222,301527,8.4,"The Green Mile (1999)"
    

    Note the use of a non-greedy quantifier, .+?, to prevent accidentally matching more than we should. Also note that I’ve enclosed the fourth column with quote marks "" in case a comma appears in the movie title – otherwise the software you use to read the file would interpret Avatar, the Last Airbender as two columns.

    The nice tabular alignment is gone – but if you open the file in Excel it will look fine.

    Alternately, just do the entire thing in Excel.

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

Sidebar

Related Questions

I'm upgrading from iBatis 2.x to myBatis 3.0.6 and I have a mapper file
I have a text file in the form ( User Id, Movie Id, Ratings,
I have a table with 3 columns which looks like this: File User Rating
I have the following xml file <ScheduleProvider id=257 scheduleDate=2008-03-20T15:34:18Z xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=my.xsd> <Content action=insert duration=7200
I have file /tmp/gs.pid with content client01: 25778 I would like retrieve the second
I have the following json file named json.txt with the following data, {id:99903727,nickname:TEST_MLA_OFF,registration_date:2010-12-03T14:19:33.000-04:00,country_id:AR,user_type:normal,logo:null,points:0,site_id:MLA,permalink:http://perfil.mercadolibre.com.ar/TEST_MLA_OFF,seller_reputation:{level_id:null,power_seller_status:null,transactions:{period:12 months,total:25,completed:25,canceled:0,ratings:{positive:0,negative:0,neutral:1}}},status:{site_status:deactive}}
Working on a problem where I have to read data from a file into
I have file locale/es/LC_MESSAGES/django.mo (and .po), ran makemessages and compilemessages. Definitely all messages are
If i have file for eg: a log file created by any background process
Say I have file A, in middle of which have a tag string #INSERT_HERE#.

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.