Difference between revisions of "Main Page/Endnote"
From phurvitz
Phil Hurvitz (talk | contribs) |
Phil Hurvitz (talk | contribs) (→A perl script for creating a sed script to fix the term list) |
||
Line 29: | Line 29: | ||
also creates a standardized term list | also creates a standardized term list | ||
<pre> | <pre> | ||
− | #! /usr/bin/perl - | + | #! /usr/bin/perl -W |
+ | use strict; | ||
use warnings; | use warnings; | ||
− | |||
− | # | + | # construct sed scripts for fixing endnote |
− | # open | + | # open output files |
− | open ( | + | open (SED, '>sed_nodots.sed'); |
− | my $ | + | open (OUTTERM, '>pmh_phd_journals_term_fixed.txt'); |
− | + | # read input file | |
− | + | open (INFILE, "<pmh_phd_journals_term.txt") or die "cannot open"; | |
− | $ | + | while (my $record = <INFILE>) { |
− | + | chomp $record; | |
− | + | # split into pieces with tabs | |
− | + | my @list = split(/\t/, $record); | |
− | # | + | # how many substrings? |
− | @ | + | my $count = @list; |
− | + | # extract the first 2 substrings | |
− | + | my $ss1 = $list[0]; | |
− | + | my $ss2 = $list[1]; | |
− | # | + | # if 3 substrings |
− | my @ | + | if ($count == 3) { |
− | + | # get the 3rd substring | |
− | # | + | my $ss3 = $list[2]; |
− | + | # handle dots | |
− | $ | + | $ss3 =~ s/\./\\\./g; |
− | + | $ss2 =~ s/\./\\\./g; | |
− | $ | + | print SED "s|$ss3|$ss1|\n"; |
− | + | print SED "s|$ss2|$ss1|\n"; | |
− | + | # if neither substring has a dot | |
− | + | if (($ss2 !~ m/\./) && ($ss3 !~ m/\./)) { | |
− | + | print OUTTERM "$ss1\t$ss3\t$ss2\n"; | |
− | + | } | |
− | + | # if the 2nd ss has a dot and the 3rd does not | |
− | + | if (($ss2 =~ m/\./) && ($ss3 !~ m/\./)) { | |
− | + | print OUTTERM "$ss1\t$ss3\t$ss2\n"; | |
− | + | } | |
− | + | # if the 3nd ss has a dot and the 2rd does not | |
− | + | if (($ss2 !~ m/\./) && ($ss3 =~ m/\./)) { | |
− | # | + | print OUTTERM "$ss1\t$ss2\t$ss3\n"; |
− | + | } | |
− | + | # if both ss have dots | |
− | # | + | if (($ss2 =~ m/\./) && ($ss3 =~ m/\./)) { |
− | $ | + | print OUTTERM "$ss1\t$ss2\t$ss3\n"; |
− | + | } | |
− | $ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
− | close | + | close INFILE; |
− | + | close SED; | |
− | + | close OUTTERM; | |
</pre> | </pre> |
Revision as of 08:28, 29 October 2007
Contents
Fixing abbreviated journal names
Some of my references had the full journal name and others had abbreviations. This causes problems when you need a bibliography in a specific format, e.g., with full names you will get the abbreviations for those that do not have full names in the reference; e.g., if you want abbreviations, EndNote will ignore the term lists for those that are stored with abbreviated names.
I got a copy of term lists from the University of Queensland.
To update the term list in Endnote
- Open the library.
- Click on Tools on the menu bar and choose Define Term Lists
- Highlight Journals
- Select all journals.
- Delete (right-click/Cut). Do not remove the term list altogehter; there does not seem to be a way to add the journals term list back with all the fields in EndNote 7, contrary to the documentation.
- Click on the Import List button.
- Select the text file to be imported and click on the Open button (I used the Medical, Biosciences, and Chemistry lists).
To fix the list (deprecated, as there is no standard for which abbreviation has the dots)
- Export the term list (click the Export List button). I saved this as pmh_phd_journals_term.txt.
- Separate the list into columns, one for the full title, and one each for the abbreviated titles.
-
cut -f1 pmh_phd_journals_term.txt > full.txt
-
cut -f2 pmh_phd_journals_term.txt > abb1.txt
-
cut -f3 pmh_phd_journals_term.txt | sed "s/\./\\./g" > abb2.txt
-
- Join the columns back together with some sed to pre-format the sed scripts for the master edit process:
A perl script for creating a sed script to fix the term list
also creates a standardized term list
#! /usr/bin/perl -W use strict; use warnings; # construct sed scripts for fixing endnote # open output files open (SED, '>sed_nodots.sed'); open (OUTTERM, '>pmh_phd_journals_term_fixed.txt'); # read input file open (INFILE, "<pmh_phd_journals_term.txt") or die "cannot open"; while (my $record = <INFILE>) { chomp $record; # split into pieces with tabs my @list = split(/\t/, $record); # how many substrings? my $count = @list; # extract the first 2 substrings my $ss1 = $list[0]; my $ss2 = $list[1]; # if 3 substrings if ($count == 3) { # get the 3rd substring my $ss3 = $list[2]; # handle dots $ss3 =~ s/\./\\\./g; $ss2 =~ s/\./\\\./g; print SED "s|$ss3|$ss1|\n"; print SED "s|$ss2|$ss1|\n"; # if neither substring has a dot if (($ss2 !~ m/\./) && ($ss3 !~ m/\./)) { print OUTTERM "$ss1\t$ss3\t$ss2\n"; } # if the 2nd ss has a dot and the 3rd does not if (($ss2 =~ m/\./) && ($ss3 !~ m/\./)) { print OUTTERM "$ss1\t$ss3\t$ss2\n"; } # if the 3nd ss has a dot and the 2rd does not if (($ss2 !~ m/\./) && ($ss3 =~ m/\./)) { print OUTTERM "$ss1\t$ss2\t$ss3\n"; } # if both ss have dots if (($ss2 =~ m/\./) && ($ss3 =~ m/\./)) { print OUTTERM "$ss1\t$ss2\t$ss3\n"; } } } close INFILE; close SED; close OUTTERM;