Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Text replacement

Name: Anonymous 2009-01-12 20:48

I need something that will take something from a text file, replace text in it, then export a new file.

Can someone please help me out?

Name: Anonymous 2009-01-12 20:50

Now you have two problems.

Name: Anonymous 2009-01-12 20:52

>>1
Computers can do that, use a computer.

Name: Anonymous 2009-01-12 20:56

What I need to do is translate letters into complicated algorithms and export the final product to a text file, where it can later be translated back using another set of algorithms and once again exported to a text file.

I was told to come here and also to try perl.

Name: Anonymous 2009-01-12 21:01

#!/usr/bin/perl -w                                      # camel code
use strict;

                                           $_='ev
                                       al("seek\040D
           ATA,0,                  0;");foreach(1..3)
       {<DATA>;}my               @camel1hump;my$camel;
  my$Camel  ;while(             <DATA>){$_=sprintf("%-6
9s",$_);my@dromedary           1=split(//);if(defined($
_=<DATA>)){@camel1hum        p=split(//);}while(@dromeda
 ry1){my$camel1hump=0      ;my$CAMEL=3;if(defined($_=shif
        t(@dromedary1    ))&&/\S/){$camel1hump+=1<<$CAMEL;}
       $CAMEL--;if(d   efined($_=shift(@dromedary1))&&/\S/){
      $camel1hump+=1  <<$CAMEL;}$CAMEL--;if(defined($_=shift(
     @camel1hump))&&/\S/){$camel1hump+=1<<$CAMEL;}$CAMEL--;if(
     defined($_=shift(@camel1hump))&&/\S/){$camel1hump+=1<<$CAME
     L;;}$camel.=(split(//,"\040..m`{/J\047\134}L^7FX"))[$camel1h
      ump];}$camel.="\n";}@camel1hump=split(/\n/,$camel);foreach(@
      camel1hump){chomp;$Camel=$_;y/LJF7\173\175`\047/\061\062\063\
      064\065\066\067\070/;y/12345678/JL7F\175\173\047`/;$_=reverse;
       print"$_\040$Camel\n";}foreach(@camel1hump){chomp;$Camel=$_;y
        /LJF7\173\175`\047/12345678/;y/12345678/JL7F\175\173\0 47`/;
         $_=reverse;print"\040$_$Camel\n";}';;s/\s*//g;;eval;   eval
           ("seek\040DATA,0,0;");undef$/;$_=<DATA>;s/\s*//g;(   );;s
             ;^.*_;;;map{eval"print\"$_\"";}/.{4}/g; __DATA__   \124
               \1   50\145\040\165\163\145\040\157\1 46\040\1  41\0
                    40\143\141  \155\145\1 54\040\1   51\155\  141
                    \147\145\0  40\151\156 \040\141    \163\16 3\
                     157\143\   151\141\16  4\151\1     57\156
                     \040\167  \151\164\1   50\040\      120\1
                     45\162\   154\040\15    1\163\      040\14
                     1\040\1   64\162\1      41\144       \145\
                     155\14    1\162\       153\04        0\157
                      \146\     040\11     7\047\         122\1
                      45\15      1\154\1  54\171          \040
                      \046\         012\101\16            3\16
                      3\15           7\143\15             1\14
                      1\16            4\145\163           \054
                     \040            \111\156\14         3\056
                    \040\         125\163\145\14         4\040\
                    167\1        51\164\1  50\0         40\160\
                  145\162                              \155\151
                \163\163                                \151\1
              57\156\056

this VALID PERL CODE should do the trick.

Name: Anonymous 2009-01-12 21:42

>>4
How does one turn a letter into an algorithm?

Name: Anonymous 2009-01-12 21:48

>>6
Letters are Turing-complete.

Name: Anonymous 2009-01-13 0:35

perl -pi -e 's/[A-Za-z]/algorithm/ge'

Name: Anonymous 2009-01-13 4:55

I THINK YOUL:L WANT TO USE SED

Name: Anonymous 2009-01-13 8:11

Use Textmate and ⌘F. I can make a screencast if necessary.

Name: Anonymous 2009-01-13 8:19

>>9
[m][08:03]    <TuringTest>    I am tracking down a regex bug from OS X to see if it is in the FreeBSD derived code. Could someone on *BSD check what the following command prints: echo "ab" | sed -E "s/(()|.)(b)/[&]/"
[08:03]    <TuringTest>    For comparison the other order in the regex is : echo "ab" | sed -E "s/(.|())(b)/[&]/"
[08:04]    <TuringTest>    They SHOULD agree, but I am seeing a difference
[08:04]    <methi>    first gives "a[b]" second "[ab]"[/m]
OH SHI-

Name: Anonymous 2009-01-13 8:20

>>11
and shiichan's bbcode is even more broken than i thought.

Name: Anonymous 2009-01-13 11:02

>>12
Shiichan parsed that perfectly, and even highlighted your errors.  It is you who is broken.

Name: Anonymous 2009-01-13 11:31

>>12
Beginner BBCODE Programmer

Name: Anonymous 2009-01-13 20:23

>>13-14
compare shitchan's bbcode implementation to every other bbcode implementation in existence. either shitchan is broken or every other bbcode implementation is.

Name: Anonymous 2009-01-13 20:39

>>15
Which do you find more likely?

Name: Anonymous 2009-01-13 21:12

>>16
considering what shii thinks of shitchan, the former.

Name: FrozenVoid 2009-01-13 21:14

Is it not possible that shiichan has a correct implementation of BBCode? I think, we need to explore this possibility.

Name: Anonymous 2009-01-14 4:48

Name: Anonymous 2009-01-14 5:10

Name: Anonymous 2009-01-14 5:22

Name: Anonymous 2010-11-15 16:01

Don't change these.
Name: Email:
Entire Thread Thread List