Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Generate Birthday List

  1. #11
    Junior Member
    Join Date
    Aug 2007
    Posts
    55

    Default

    Why do you want to do this in bash?
    IMHO it pays off to learn a (proper) scripting language like perl/python/ruby to do this kind of stuff. It's way more powerful and easier. The time you spend trying to do this in bash could better be used to learn such a language... but that's just my 2 cents

    anyway...again: about 2 minutes of ruby coding:

    Code:
    #!/usr/bin/env ruby
    def append(str)
      f = File.open("append.txt", "r")
      line = f.readlines
      line.each do |li|
        puts str + li
      end
      f.close
    end
    arr = $<.readlines
    arr.each do |s|
      s.chomp!
      append(s)
    end

    and then just create a file with stuff you want to append, named append.txt and pipe through the proggy like this :

    Code:
    barbsie-mbp:~ $ echo blah | ./append.rb 
    blah1
    blah12
    blah123
    barbsie-mbp:~ $
    or with 2 files:

    Code:
    barbsie-mbp:~ $ cat blah.txt | ./append.rb 
    blah1
    blah12
    blah123
    blahblah1
    blahblah12
    blahblah123
    barbsie-mbp:~ $

  2. #12
    Just burned his ISO
    Join Date
    Dec 2006
    Posts
    18

    Default

    Hmmm...jou...you are certainly right Barabas ;-)
    I will give it a try!!

    Now I will work me through your code and give it some tests.

    best regards
    Joerg

Page 2 of 2 FirstFirst 12

Posting Permissions

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