|
Posted by Andy on February 28, 2008, 1:09 pm
Please log in for more thread options >
>
>
> > Morning Guys
>
> > I am pretty new here, tyring to learn as I go.
>
> > I have a lil project I am trying to setup
>
> > Basically : below is a piece of the file
>
> > Has three fields Seperated by ~
>
> > 6081703039~1~My Own Company
> > 3081709039~1~DeweyCheetham&Howe
> > 9081710039~1~One Bad Firm
> > 2081757039~1~IRSUSUCK
> > 1082445039~1~
>
> > Basically I need the file to only show the Field that has all data
>
> > I am new so not sure if my syntax is correct
>
> You haven't shown any syntax. How can we help you fix your syntax (if
> indeed it is broken) if you don't show it?
>
> > If field 3 is blank then don't show?
>
> > Can anyone help me write a Perl script to acocmplish this ?
>
> Sure. We can indeed help. Best place to start would be by showing
> what you have so far, so that we can guide you towards improving and
> repairing it.
>
> In the meantime, here's a brief pseudo-code of what I gather you want
> to do:
> read a file line by line
> for each line,
> obtain the fields separated by hyphens
> if the number of fields equals 3
> print the line to a new file
> endif
> endfor
> replace the old file with the new one
>
> Paul Lalli
Good Day
Thanks Paul
Ok, I have absolutely zero So far.
Two days ago I opened the Learning Perl book and Have been trying to
learn it
Its not as hard as I thought, but I am trying to learn it as I work.
lol
Honestly the whole thing is we get a file...As the above snippet I
pasted.
And The script is only supposed to show the field that has a full line
Hence when we run the script I would only see
FIELD1 2 Field3
6081703039~1~My Own Company
> > 3081709039~1~DeweyCheetham&Howe
> > 9081710039~1~One Bad Firm
> > 2081757039~1~IRSUSUCK
Again I apologize if my whole message was written wrong.
I am still learning this, mind you I only picked up the book on Monday
Thank you for your patience.
|