Re: Help with script



On Feb 28, 3:04 pm, John Bokma <j...@xxxxxxxxxxxxxxx> wrote:
Andy <Ramr...@xxxxxxxxx> wrote:
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

what syntax?

If field 3 is blank then don't show?

perl -ne "/~$/ or print;" yf.txt

or

perl -ne "print unless /~$/" yf.txt

(yf.txt is your file :-) )

(assuming Windows, otherwise you might want to use single quotes)

Note: this assumes that the 3rd field can never end in ~
and that the 3rd field blank means empty.

--
John

http://johnbokma.com/mexit/2008/02/

John

thank you that worked wonderfully

although I am trying to understand why.

But as I was playing around I removed some characters from the file

and it prints data from lines that I removed the ~1~ For instance the
1

Can u explain some of this ,

Pardon if I am asking to much, but I am curious.

I have been wanting to delve into perl for a long while.


.



Relevant Pages

  • Re: Help with script
    ... 9081710039~1~One Bad Firm ... You haven't shown any syntax. ... Two days ago I opened the Learning Perl book and Have been trying to ... And The script is only supposed to show the field that has a full line ...
    (comp.lang.perl.misc)
  • RE: Too Few Parameters Error
    ... I guess I was looking at it so long I didn't notice the syntax. ... You have the reference to the controls on ... YOu also have too many single quotes in the wrong places. ... >> Dim rst As DAO.Recordset ...
    (microsoft.public.access.formscoding)
  • Re: Date in file name
    ... Use single quotes around the ddmmyyyy instead of double quotes. ... I tells me I have a syntax error in the visual basic module ... Steve Schapel, Microsoft Access MVP ...
    (microsoft.public.access.macros)
  • Re: CASE statement
    ... The CASE syntax looks fine except that you should enclose the literal in ... single quotes instead of double quotes so that it will work regardless of ... > but this syntax doesn't fly ...
    (microsoft.public.sqlserver.programming)
  • Re: Help deleting fields in SQL table
    ... I've been playing about some more - it looks like the SQL string is ... too long - if I do it in chunks it works. ... Also, some of my syntax ... wasn't quite right - I've changed it to allow for no single quotes ...
    (microsoft.public.excel.programming)