Re: Extract same text from file.
From: Abhinav (matrix_calling_at_yahoo.dot.com)
Date: 08/16/04
- Next message: Abhinav: "Re: Extract same text from file."
- Previous message: Mark: "IPC::Shareable exceptionally slow on large segs"
- In reply to: Ryan Keeling: "Extract same text from file."
- Next in thread: Abhinav: "Re: Extract same text from file."
- Reply: Abhinav: "Re: Extract same text from file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 16 Aug 2004 15:43:35 +0530
Ryan Keeling wrote:
> Hi
> I have the following text file which I want to use to populate text
> files containing data only relevant to a particular project. Is it
> possible for me to group similar lines together and put them in their
> own text file? Such as a file containing all entries for
> MS102_PCP.Implementation and another file for MS102_PCP.Support.
>
> Any help would be greatly appreciated!
>
>
> 2004:01:07:3:02:MS102_PCP:Belfast:Charge:PCP:Implementation:+:5.5
> 2004:01:07:3:02:MS102_PCP:Belfast:Charge:PCP:Support:+:2.0
> 2004:01:05:1:02:MS102_PCP:Belfast:Charge:PCP:Implementation:+:7.5
> 2004:01:09:5:02:MS102_PCP:Belfast:Charge:PCP:Meetings:+:1.0
> 2004:01:20:2:04:MS102_PCP:Belfast:Charge:PCP:Standards:6.5
> 2004:01:19:1:04:MS102_PCP:Belfast:Charge:PCP:Standard:7.5
> 2004:02:03:2:06:MS102_PCP:Belfast:Charge:PCP:Support:+:2.0
> 2004:03:02:2:10:MS102_PCP:Belfast:Charge:PCP:Implementation:+:5.5
> 2004:03:03:3:10:MS102_PCP:Belfast:Charge:PCP:Implementation:+:7.5
> 2004:03:02:2:10:MS102_PCP:Belfast:Charge:PCP:Support:+:2.5
> 2004:03:26:5:13:MS102_PCP:Belfast:Charge:PCP:Support:+:7.5
> 2004:03:29:1:14:MS102_PCP:Belfast:Charge:PCP:Support:+:8.0
> 2004:03:30:2:14:MS102_PCP:Belfast:Charge:PCP:Implementation:+:8.0
> 2004:01:05:1:02:MS102_PCP:Belfast:Charge:PCP:Project-Control:+:7.5
> 2004:01:06:2:02:MS102_PCP:Belfast:Charge:PCP:Meetings:+:2.0
> 2004:01:06:2:02:MS102_PCP:Belfast:Charge:PCP:Meetings:+:0.7
>
Something like this (untested) ?
use strict;
use warnings;
while (<STDIN>)
{
my @outStr = split ':';
system qq(echo '$_' >> '$outStr[9].txt');
}
Regards
-- Abhinav
- Next message: Abhinav: "Re: Extract same text from file."
- Previous message: Mark: "IPC::Shareable exceptionally slow on large segs"
- In reply to: Ryan Keeling: "Extract same text from file."
- Next in thread: Abhinav: "Re: Extract same text from file."
- Reply: Abhinav: "Re: Extract same text from file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|