Identify nodes in the same level using a pattern

Discussion in 'Perl Misc' started by karthik.prabaharan@gmail.com, Mar 15, 2006.

  1. Guest

    Hi,

    Can someone help me with a solution for the following?

    I have a text file in the following fashion:

    Level, ID, Rev,Name,Date
    0, PRGCD338HL, 2, F_Program, Jan-10-2006
    1, PHCD3380229H2, 1, F_Placeholder, Feb-11-2006
    2, DSCD3380229H1, 1, F_DesignSolution, Jan-21-2006
    3, FDR0022904NPSM6, 1, F_DesignRep, Feb-11-2006
    1, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    2, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    2, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    1, PHCD3380229H3, 1, F_Boxholder, Jan-10-2002
    2, FDR0022904NPSM6, 1, F_DesignRep, Jan-31-2003
    2, FDR022904NPSM1, 1, F_DesignRep, Feb-11-2006
    1, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    2, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    3, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    3, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004

    I need to identify all the nodes in the same level attached to
    F_Placeholder immediately.

    For the above input, I require the following output:

    2, DSCD3380229H1, 1, F_DesignSolution, Jan-21-2006

    2, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    2, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004

    3, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    3, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004

    Thanks,
    Karthik
     
    , Mar 15, 2006
    #1
    1. Advertising

  2. Paul Lalli Guest

    wrote:

    > Can someone help me with a solution for the following?


    In order to "help" you with a solution, someone would need to see your
    attempt at a solution first.

    > I have a text file in the following fashion:
    >
    > Level, ID, Rev,Name,Date
    > 0, PRGCD338HL, 2, F_Program, Jan-10-2006
    > 1, PHCD3380229H2, 1, F_Placeholder, Feb-11-2006
    > 2, DSCD3380229H1, 1, F_DesignSolution, Jan-21-2006
    > 3, FDR0022904NPSM6, 1, F_DesignRep, Feb-11-2006
    > 1, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    > 2, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 2, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    > 1, PHCD3380229H3, 1, F_Boxholder, Jan-10-2002
    > 2, FDR0022904NPSM6, 1, F_DesignRep, Jan-31-2003
    > 2, FDR022904NPSM1, 1, F_DesignRep, Feb-11-2006
    > 1, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    > 2, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    > 3, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 3, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    >
    > I need to identify all the nodes in the same level attached to
    > F_Placeholder immediately.
    >
    > For the above input, I require the following output:
    >
    > 2, DSCD3380229H1, 1, F_DesignSolution, Jan-21-2006
    >
    > 2, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 2, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    >
    > 3, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 3, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004


    What have you tried so far? How did it fail to realize your goal?
    What error or faulty output did it create that you don't understand?

    Note that, in general, this newsgroup does not function as a "write
    some code for me" helpdesk. You have to show that you've put forth
    some effort into solving your problem first.

    Have you read the Posting Guidelines that are posted here twice a week?
    They contain invaluable information on how to get the most, best help
    out of this newsgroup.

    Paul Lalli
     
    Paul Lalli, Mar 15, 2006
    #2
    1. Advertising

  3. wrote:
    > Hi,
    >
    > Can someone help me with a solution for the following?
    >
    > I have a text file in the following fashion:
    >
    > Level, ID, Rev,Name,Date
    > 0, PRGCD338HL, 2, F_Program, Jan-10-2006
    > 1, PHCD3380229H2, 1, F_Placeholder, Feb-11-2006
    > 2, DSCD3380229H1, 1, F_DesignSolution, Jan-21-2006
    > 3, FDR0022904NPSM6, 1, F_DesignRep, Feb-11-2006
    > 1, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    > 2, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 2, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    > 1, PHCD3380229H3, 1, F_Boxholder, Jan-10-2002
    > 2, FDR0022904NPSM6, 1, F_DesignRep, Jan-31-2003
    > 2, FDR022904NPSM1, 1, F_DesignRep, Feb-11-2006
    > 1, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    > 2, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006
    > 3, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 3, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    >
    > I need to identify all the nodes in the same level attached to
    > F_Placeholder immediately.
    >
    > For the above input, I require the following output:
    >
    > 2, DSCD3380229H1, 1, F_DesignSolution, Jan-21-2006
    >
    > 2, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 2, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004
    >
    > 3, FDR0022904NPSM6, 1, F_DesignRep, Apr-01-2006
    > 3, FDR022904NPSM1, 1, F_DesignRep, Jan-21-2004


    2, PHCD3380229H4, 1, F_Placeholder, Jan-10-2006

    is a 'node' attached to F_Placeholder. why should that not show up in
    your output?
     
    it_says_BALLS_on_your forehead, Mar 15, 2006
    #3
  4. Guest

    wrote:
    > I need to identify all the nodes in the same level attached to
    > F_Placeholder immediately.
    >
    > For the above input, I require the following output:


    I will assume that the demanding tone of your question is because
    English is not your first language (not because you are trying to be
    rude). However, you multi-posted this question also to comp.lang.awk,
    and multi-posting is ALWAYS rude.

    Please read the posting guidelines for this group. Tad's server (where
    the guidelines are normally hosted) seems to be down at the moment, but
    the guidelines are posted to this newsgroup regularly and may be read
    here: http://tinyurl.com/obcre

    --
    http://DavidFilmer.com
     
    , Mar 15, 2006
    #4
    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. asd
    Replies:
    3
    Views:
    452
    Arnaud Berger
    May 23, 2005
  2. gavnosis
    Replies:
    0
    Views:
    537
    gavnosis
    Aug 2, 2003
  3. Replies:
    1
    Views:
    604
    Soren Kuula
    Aug 24, 2006
  4. pabbu
    Replies:
    8
    Views:
    756
    Marc Boyer
    Nov 7, 2005
  5. johkar
    Replies:
    2
    Views:
    892
    johkar
    May 29, 2009
Loading...

Share This Page