Remove data from 1 column in text file

Sthendal Posted messages 2 Status Member -  
 Sthendal -
Hello,

I am looking to delete the data from a column in a text file (which opens natively with Notepad), without losing the formatting of my column (so that it remains empty for the number of characters it was allotted).

However, it seems that it is not possible to select a column alone.

Thank you for your advice.
Sthendal
Configuration: Windows XP Internet Explorer 7.0 Notepad 5.1

4 answers

  1. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    hello
    it's probably possible with Openoffice.
    what is the column separator? are the columns of fixed width?
    can we see an example of data?
    0
    1. Sthendal Posted messages 2 Status Member
       
      Hello Dubcek,

      Thank you for being interested in my problem.

      This is a file generated by a software that creates it in the following format:
      Filler: from 1 to 1
      Title: from 2 to 25
      Filler: from 26 to 26
      Nb dif: from 27 to 30
      Filler: from 31 to 31
      Num title: from 31 to 32
      Filler: from 33 to 33
      Duration: from 34 to 38
      Filler: from 39 to 39
      Name: from 40 to 63
      Filler: from 64 to 64
      etc...

      I want to delete the data present in the "Name" column (from position 40 to 63) while keeping the structure of the file.
      I will have about forty files to process in this way...
      0
  2. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    Do you have Openoffice?
    Try it:
    search ^(.{40})(.{23})
    replace $1 <- here 23 spaces

    Check in other options that regular expressions are enabled
    For 40 files, you might consider a tool like sed.
    0
    1. Sthendal
       
      I downloaded OpenOffice that I didn't have.
      Since I've never used it before, I'm fumbling around (to say the least...).
      I imagine that the 2 command lines you suggest are a macro to be executed? (Tools menu / macro?).
      Otherwise, I opened my txt file, but since the lines in the original file are long (up to position 202), it wraps to the next line...
      0
  3. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    You need to go to Edit -> Find & Replace
    it should keep the lines when re-saving it as txt, you need to try.
    0
    1. Sthendal
       
      not bad at all! (I couldn't manage it the first time because I hadn't found where to check the regular expressions..)

      I modified: search ^(.{40})(.{23}) to: search ^(.{39})(.{24}), because it started the replacement one character too far. Now it's fine.

      However, instead of inserting spaces in place of the old data, it clearly writes "<- here 23 spaces"...
      0
  4. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    In replace, $1 means the first 39 characters and you need to press the spacebar 23 times after, you can't see it if I do it.
    0
    1. Sthendal
       
      QED!
      It works, it's great!
      A big thank you, Dubcek.
      0