I was trying many different combinations without success, at this point I would be really grateful for your help.
I need to replace this end of the line multiple times (around 300) and it would be painful to replace it one by one:
:;XXXXXX (lenght may vary)
I was able to find it with :;*$
which highlights exactly what I need!
But I'm unable to replace it, to make it look like this: :;XXXXXX;;;
*
- is supposed to match anything (and it does)
$
- is supposed to match end of the line (and it does)
I've tried encapsulating *
in brackets (*); [*]
...like :;(*);;;$
among other things, but to no avail. Of course replacement is made, but in the same form as input. For example... instead of :;XXXXXX;;;
I get :;*;;;
- and that is the best I was able to get out of it.
This is UltraEdit regular expression format, but this piece of software can process Unix and Perl regular expressions as well.
I you can suggest ANY way to do this, I will give it a try (terminal, another software etc.).
EDIT:
I'm trying to get contacts from old nokia to newer nokia (s30+ series). There was only backup.nbu from which I got .vcf contacts. I have put them to one file via cat *.vcf > combined.vcf
. I've found Excel macro and PHP script which were supposed to do the whole process, but they didn'work - but all this is not that relevant I guess. After that I have found Vcard format this particular model can process. Now I'm trying to modify it, to look the same. Replacing lines was no problem, but I need to edit ends. ;:NAME
to ;:NAME;;;
without modifying names...
I tried what I've described above. After that I've tried suggested sed -ri "s/\:\;X+$/&\;\;\;/g"
.
I tough that DOS ends of the lines might be the problem, so I ran:sed -i 's/\r//g' combined.vcf
and then again the suggested sid command.
FROM: N;CHARSET=UTF-8;ENCODING=8BIT:ALFA
TO: N;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:;ALFA;;;
EDIT2:
So I went from the beginning...
I've combined .vcf files
Opened them in UltraEdit and saved as LF (from CRLF) - tried this time without
sed
and terminalIn find replace I've selected Perl Regex
Find
(:;)(.*)
Replace
\1\2;;;
For reference: .*
- Match zero or more of any characters (except new line)...
DONE!