Re: Help with script
- From: Andy <Ramroop@xxxxxxxxx>
- Date: Thu, 28 Feb 2008 12:41:00 -0800 (PST)
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.
.
- References:
- Help with script
- From: Andy
- Re: Help with script
- From: John Bokma
- Help with script
- Prev by Date: Re: Generate an associative array from a file
- Next by Date: Reading file issue
- Previous by thread: Re: Help with script
- Next by thread: Re: Help with script
- Index(es):
Relevant Pages
|