updated git and svn scripts
[xrzperl.git] / delicious_select_tag
blobdf45507caeca4008317267f34dcdbf785ae32886
1 #!/usr/bin/perl -w
2 ###APPNAME: delicious_select_tag
3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Fri May 21 02:37:57 2010
5 ###APPVER: 0.1
6 ###APPDESC: delicious_select_tag
7 ###APPUSAGE: (tags...)
8 ###APPEXAMPLE: delicious_select_tag
9 ###APPOPTION:
10 use strict;
12 #ENV variable MUST be defined somewhere,
13 #FOR perl to search modules from,
14 #OR nothing will work
15 use lib $ENV{XR_PERL_MODULE_DIR};
17 use MyPlace::Script::Usage qw/help_required help_even_empty/;
18 exit 0 if(help_required($0,@ARGV));
19 #exit 0 if(help_even_empty($0,@ARGV));
21 print <<'HEAD'
22 <!DOCTYPE NETSCAPE-Bookmark-file-1>
23 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
24 <!-- This is an automatically generated file.
25 It will be read and overwritten.
26 Do Not Edit! -->
27 <TITLE>Bookmarks</TITLE>
28 <H1>Bookmarks</H1>
29 <DL><p>
30 HEAD
33 my @tags;
34 foreach(@ARGV) {
35 push @tags,split(/\s*,\s*/,$_);
38 my @rtags;
39 foreach(@tags) {
40 push @rtags,qr/TAGS="[^"]*$_[^"]*"/i;
42 my $status=0;
43 while(<STDIN>) {
44 s/<DL><p>//;
45 # print STDOUT "########\t$_";
46 if(/<DD>/) {
47 if($status eq "delete") {
48 $status="clean";
49 next;
51 print $_;
53 else {
54 $status="delete";
55 foreach my $tag(@rtags) {
56 if($_ =~ $tag) {
57 print $_;
58 $status="print";
59 last;
65 print <<'FOOT'
66 </DL><p><!-- fe02.secure.del.ac4.yahoo.net uncompressed/chunked Thu May 20 11:28:06 PDT 2010 -->
67 FOOT