I have a txt file where data is arranged in a list eg:

0001
0002
0003
0004

etc...
Andy i would like to change specific columns to the same data eg:
|
0a01
0a02
0a03
0a04
|

Recommended Answers

All 6 Replies

What have you attempted already?
If you haven't done anything yet, then you could start by using a strategy like reading in the file to a string and then change the element of the string that you want before outputting to a second file. Other than that, it's hard to say too much without more of an idea of what you're doing. Good luck.

I'm designing a password cracker for uni and im trying to make password lists to try 1 by 1 but to make my list making quicker, i need to be able to change a column very quickly eg:
( actual excert )

aaaaaa
aaaaab
aaaaac
aaaaad
aaaaae

so once i get to the end i can copy the file, edit 1 column and change it like so:

aaaaba
aaaabb
aaaabc
aaaabd
aaaabe

so it takes a quarter of the time

Hmm... I'm still not that sure what you're trying to do, but if I wanted to go through a list of all lower case alphabet possibilities for, say, a 3-letter word, then I might go for something like

int charOffset = static_cast< int >('a');
string word;

for(int i = 0; i < 26; i++){
  for(int j = 0; j < 26; j++){
    for(int k = 0; k < 26; k++){
      word =  (char)i + (char)j + (char)k;
      cout << word << endl;
    }
  }
}

nah not quite, ok ill try explain. A text file has letter rows, and letter columns. I need a code that can access these columns and change a specific column (say column 3) and change it ALL to say 4

this will change the third character of every line in infile.txt to 4 and put the result in outfile.txt sed 's/^\(..\)\(.\)/\14/' < infile.txt > outfile.txt

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.