Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Use ffind with regular expressions against a text file

Aug
2,799
144
I have a file that I generate everyday called holdings.txt

Each line in the file begins with a stock ticker.

The stock ticker is seven characters in length.

The stock ticker is right-aligned,
so the beginning of each stock ticker contains spaces.

Using ffind with regular expressions allows me to filter the desired stock tickers.

When I want to view the grocery stocks in holdings.txt,
I run the following;

Code:
type r:\holdings.txt | ffind /kvm /e"^( {6}L| {2}EMP.A| {4}(DOL|MRU))"

...which filters the desired stock tickers...
Code:
      L
    DOL
  EMP.A
    MRU

When I want to view the bank stocks in holdings.txt,
I run the following;

Code:
type r:\holdings.txt | ffind /kvm /e"^( {4}BMO| {5}(CM|TD|NA|RY) )"

...which filters the desired stock tickers...
Code:
     CM
     TD
     NA
     RY
    BMO

Just examples of how to use ffind with regular expressions against a text file.

Joe
 
Back
Top