Professional Web Applications Themes

Newbe needs help - PERL Beginners

Hi all can anyone help with a direct command line syntax for the following im trying to add text to the end of the last line in a text file like so aaa bbb ccc Wishing to add ddd on the end of this list. I have tried the following but it doesnt have quite the desired effect any help would be good. perl -pi -e s/'$'/'ddd'/g script1 This gives me this aaaddd dddbbbddd dddcccddd dddddd ddd...

  1. #1

    Default Newbe needs help

    Hi all can anyone help with a direct command line syntax for the following
    im trying to add text to the end of the last line in a text file like so

    aaa
    bbb
    ccc


    Wishing to add ddd on the end of this list.
    I have tried the following but it doesnt have quite the desired effect
    any help would be good.

    perl -pi -e s/'$'/'ddd'/g script1

    This gives me this


    aaaddd
    dddbbbddd
    dddcccddd
    dddddd
    ddd


    Sadman Guest

  2. #2

    Default RE: Newbe needs help


    I would recommend getting a strong grasp of Perl before you start trying to
    make one-liners for problems like this, since you can end up making a simple
    problem much more complicated. What's wrong with this:

    ####################

    use strict;
    use warnings;
    open(OUTFILE,">>script1") || die "Couldn't open script1 for writing!\n";
    print OUTFILE "ddd\n";
    close OUTFILE;

    ####################

    -----Original Message-----
    From: sadman [mailto:sadmanphp1.co.uk]
    Sent: Tuesday, October 28, 2003 2:56 PM
    To: [email]beginnersperl.org[/email]
    Subject: Newbe needs help


    Hi all can anyone help with a direct command line syntax for the following
    im trying to add text to the end of the last line in a text file like so

    aaa
    bbb
    ccc


    Wishing to add ddd on the end of this list.
    I have tried the following but it doesnt have quite the desired effect
    any help would be good.

    perl -pi -e s/'$'/'ddd'/g script1

    This gives me this


    aaaddd
    dddbbbddd
    dddcccddd
    dddddd
    ddd



    --
    To unsubscribe, e-mail: [email]beginners-unsubscribeperl.org[/email]
    For additional commands, e-mail: [email]beginners-helpperl.org[/email]
    Tim Johnson Guest

  3. #3

    Default Re: Newbe needs help

    Tim Johnson wrote:
    >I would recommend getting a strong grasp of Perl before you start trying to
    >make one-liners for problems like this, since you can end up making a simple
    >problem much more complicated. What's wrong with this:
    >
    >####################
    >
    >use strict;
    >use warnings;
    >open(OUTFILE,">>script1") || die "Couldn't open script1 for writing!\n";
    >print OUTFILE "ddd\n";
    >close OUTFILE;
    >
    >####################
    >
    >-----Original Message-----
    >From: sadman [mailto:sadmanphp1.co.uk]
    >Sent: Tuesday, October 28, 2003 2:56 PM
    >To: [email]beginnersperl.org[/email]
    >Subject: Newbe needs help
    >
    >
    >Hi all can anyone help with a direct command line syntax for the following
    >im trying to add text to the end of the last line in a text file like so
    >
    >aaa
    >bbb
    >ccc
    >
    >
    >Wishing to add ddd on the end of this list.
    > I have tried the following but it doesnt have quite the desired effect
    >any help would be good.
    >
    >perl -pi -e s/'$'/'ddd'/g script1
    >
    >This gives me this
    >
    >
    >aaaddd
    >dddbbbddd
    >dddcccddd
    >dddddd
    >ddd
    >
    >
    >
    >
    >
    Hi Tim
    i have lert a few basics but still im stuck on a
    problem ;-( maybe you could help.
    Using the code yyou sent me it will add the exact text stated at the
    bottom of the file it opens.
    What i need to do now is instaed of having the text in the code, have it
    open up another txt file read the whole txt file and then add all the
    text from that said file to the end of the outfile, im sure this is
    simple but ive obviously missed something somewere ;-(
    any help would be great
    Thanks
    sadman


    Sadman Guest

  4. #4

    Default Re: Newbe needs help


    On Dec 5, 2003, at 11:20 PM, sadman wrote:
    [..]
    > i have lert a few basics but still im stuck on a problem ;-(
    [..]
    > What i need to do now is instaed of having the text in the code,
    > have it open up another txt file read the whole txt file and then
    > add all the text from that said file to the end of the outfile,
    > im sure this is simple but ive obviously missed something somewere ;-(
    Now we are moving into the land of choices.

    we need an input file, and an output file
    to append it to???

    say something like

    cat inputfile >> outputfile

    ???
    but in perl in the form

    append_file inputfile outputfile

    ????
    my ($input_file , $output_file) = ARGV;

    open(IN, "$input_file") or die "problem with inputfile: $!\n";
    open(OUT, ">>$output_file") or die "problem with output_file: $!\n";

    print OUT $_ while(<IN>);

    close(IN);
    close(OUT);



    ciao
    drieux

    ---

    Drieux Guest

  5. #5

    Default Newbe needs help

    I will aplogize in advance. I hate to ask someone to hold my hand in the
    process but I really need the help. I am currently using Windows Media Server
    to stream my audio and video files. I like the idea of using Flash since it
    has no problems streaming to Windows or Mac.

    I have a fresh install of FCS 1.5. Here is what I want to do. Does anyone
    know where I can find a step by step tutorial for this or would anyone care to
    help me? I have no flash action script experience.

    I want to store my audio and video files in on a drive array not in the
    default install directory. The E: drive on my server is my drive array.

    I want to be able to click a link on my website (seperate webserver) that
    points to a particular audio or video file on my FCS. I want the audio or
    video to play in a browser imbedded player.

    So I need a player and need to know how to point that player to the streaming
    server and file I want to play. I will have the file name available.

    I need to know how to configure my Flash Com. Server to point to my drive
    array and what ever action script I need to place in the FCS so that it knows
    to stream the file when the player requests it if that is nessesary.

    I am sure there is a lot to this task but I have no idea where to start. I am
    sure this is something that is commonly done but I have no idea how to do this.

    Any help would be appreciate.

    I can be reached at [email]mrortnerconwaycorp.net[/email]

    Thanks

    mrortner Guest

  6. #6

    Default Re: Newbe needs help

    The thing about FMS is that without at least some actionscript knowlege, you're
    really limited in what you can do, and you'll end up with applications that
    aren't secure. FMS isn't an "out of the box" streaming server like Windows or
    Real server, and there is no "click a link to play" way of doing things.

    The connection to FMS has nothing to do with the browser. It's the Flash movie
    that makes and manages the connection, and there is no prebuilt user end flash
    "media player" to speak of (not like WMP or Quicktime that autimatically play
    the media files).

    You'll need to either build your own player (using flash), or you'll need to
    use one of the prefab players out there (try flvplayer.com for a few listings).

    If your video streaming application is going to be publicly accessible,
    you're also going to want to consider security. FMS has no built in sort of
    security features, so you'll want to be sure to protect your application from
    abuse with your own server side actionscript. An unprotected application leaves
    the door open for unauthorized use of your bandwidth and connections.

    I'd suggest picking up a copy of "Programming Flash Communication Server"
    (O'Reilly). It will help you get a grip on all of the basics you need to
    understand.

    JayCharles Guest

  7. #7

    Default Re: Newbe needs help

    Thanks so much for the help and suggestions. I am really trying to find a
    solution that I can stream video and audio and there are no issue with Mac. I
    could do real or quicktime but then there has to be a seperate install on most
    PCs for the player. With Flash, pretty much everyone has it and it is easily
    cross platform.

    I think the player will be easy enough. Getting my server secured may be the
    hard part. I will try and get my hands on a book. I really don't care about
    doing anything else with FCS except to simply stream my audio and video files
    to a browser so hopefully it won't be too hard.

    Thank you very much for your response.

    Mike

    mrortner Guest

Similar Threads

  1. newbe
    By Artemio in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 19
    Last Post: September 27th, 05:30 PM
  2. Newbe needs help.
    By bredal Jensen in forum ASP.NET Web Services
    Replies: 3
    Last Post: July 7th, 03:13 PM
  3. newbe background
    By Québec in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 19th, 07:42 PM
  4. Newbe php help
    By eboogyman in forum PHP Development
    Replies: 4
    Last Post: October 1st, 03:29 PM
  5. newbe THANKS
    By Clif Gallagher in forum Linux Setup, Configuration & Administration
    Replies: 1
    Last Post: July 14th, 06:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139