Extract a portion from a line of a text-file

Discussion in 'Java' started by Prabh, Sep 1, 2003.

  1. Prabh

    Prabh Guest

    Hi,
    I'm rather new to Java and more of a Perl guy.
    Could anyone give some ideas how to accomplish the following, please?

    I need to extract certain information from a text-file and generate a new file.

    "From" file:
    =============
    It is a .properties file with a series of property settings.

    Setting1 = "Foo"
    Setting2 = "Bar"


    Generated File:
    ==============
    Generated file would contain info along the lines,

    Setting1 obtained from "From" file = Foo

    --------------------------------------------------------------

    Basically, for each property I need to extract its value.

    In Perl I'd do something like,
    $valueFromSetting1 = (split(/=/,$line))[1] if ( $line =~ /Setting1/ ) ;

    Could anyone point me to the right Java docs, manuals I should read.

    Thanks,
    Prabh
     
    Prabh, Sep 1, 2003
    #1
    1. Advertising

  2. Marco Schmidt, Sep 1, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tharma
    Replies:
    5
    Views:
    512
    Skeleton Man
    May 21, 2004
  2. Prabh
    Replies:
    2
    Views:
    952
    Weichao Wang
    Sep 9, 2003
  3. kaushikshome
    Replies:
    4
    Views:
    779
    kaushikshome
    Sep 10, 2006
  4. scad
    Replies:
    23
    Views:
    1,181
    Alf P. Steinbach
    May 17, 2009
  5. googler
    Replies:
    1
    Views:
    97
    Xicheng Jia
    May 9, 2007
Loading...

Share This Page