10-07-04 10:49 PM
In article <5bd5ead2.0410071050.2feba65d@posting.google.com>,
rash <rashidvoip@yahoo.com> wrote:
>Here is scenari0
>223 files copied to this this one big flat file.
>
>now how to make this file to 223 files.
>
>further explaination:
>below is excerpt from that one file under xxxxx
>you will see
>@TC_ID: :BIC4007
>then another @TC_ID: :BIC40008 and
>has a 223 time with TC_ID: :BICxxx numbers
>
>How do I use such a script that makes a file named BIC40008, then
>another BIC40007
>AND copying the content from line @TC_ID: :BIC40007 till one line
>before the next TC_ID: :BIC40008
*IF* the 'sections' are all exactly the same number of lines, then
'man split'.
Otherwise, this is an 'awkward' job, thus _awk_ is right tool.
1) when the string ^@TC_ID: is matched, extract the 2nd 'word' on the
line, and save it for use as the output file name.
2) for each line, print to a file named with the saved value.
housekeeping, when you change the output file name, you will probably
need to close previously open output file, to avoid exhausting file handles.
>
>
>
>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>@TC_ID: :BIC40007
>@TC_TITLE:
>@ACT_IDS:
>@AUTHOR:
>@AUTO:
>@CLASS:
>@GROUP_ID:
>@RELEASES:
>@TC_DETAILS_FILENAME:
>@BILLING_FILENAME:
>
>@TC_ID: :BIC40008
>@TC_TITLE:
>@ACT_IDS:
>@AUTHOR:
>@AUTO:
>@CLASS:
>@GROUP_ID:
>@RELEASES:
>@TC_DETAILS_FILENAME:
>@BILLING_FILENAME:
>
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxx
>
>I have tried using this script only creating these files
>but doesnt go that far
>
>but just makes only 146 files rather then 223 files
>
>any ideas
>
>thanks
>in advance
[ Post a follow-up to this message ]
|