Well, the first thing is to determine the file format of the target
(Pidgin) and how it differs from the file format of the original (ICQ).
Say for example the pidgin format was:
name, connect_time, text
name2, connect_time2, text2
name3, connect_time3, text3
etc…
and the ICQ format was:
connect_time, text, name
connect_time2, text2, name2
connect_time3, text3, name3
etc…
then one could use awk to convert the icq file into the pidgin format
with something like (from the command line):
awk { print $2, print $3, print $1 } icqlogfile.txt >
pidginlogfile.txt
with the numbers above standing for the position that they appear in
the file.
Now, it’s likely that it’s not going to be quite that straight forward.
Say for example that there’s a ‘column’ in the ICQ file that’s not in
the pidgin file. In that case a sed command could be used to strip that
column out of the ICQ file.
Sed relies on regex which can get quite harry to read/write but a
simple example:
Say I wanted to remove the name, name2, name3, etc column from my
example above. It could be done in sed with something like:
sed -f sedscript.sed icqfile.txt > strippedicqfile.txt
where sedscript.sed contains:
s/name*[0-9]//g
the ‘s’ above indicates to sed to substitute the regex pattern match
following the slash with what follows the next slash–in this case
nothing; and the ‘g’ at the end tells sed to do it globally (i.e., for
each occourance and not just the first.)
I found the O’Reily book on sed & awk really useful in figuring all
this out. I think it was just called “Sed & Awk”. Alternatively
there’s lots of web resources on the two programs but if you’re really a
masochist you can type ‘man sed’ and ‘man awk’ at the terminal.
–
yu210148
yu210148’s Profile: http://forums.opensuse.org/member.php?userid=19157
View this thread: http://forums.opensuse.org/showthread.php?t=405081