grep, etc
Fairlight
fairlite at fairlite.com
Wed Aug 11 12:30:40 PDT 2004
The honourable and venerable Robert Pulliam M.D. spoke thus:
> I have created a file using the export commant in filepro. It is text with a newline record seperator. the file looks like this:
>
> ISA*00000089** *
> CLM*inv123456*a*b*c -213
> SV1*23456*25*A*B -214
>
> i WANT TO BE ABLE TO VIEW A RANGE OF LINE USING GREP, MORE OR AWK. IS THIS POSSIBLE. IE FROM -213 TO -216
No, but you can view a range like this:
tail +213 filename |head -4
That would give you 213-216.
Now if you need to always view the same window size but the specific data
starts in one place and you need to combine grep's functionality with
multi-line views, you could try something like:
tail +`grep -n unique_pattern /path/to/data |awk -F: '{print $1}' |head -1` \
/path/to/data | head -5
The nested `head -1` makes sure you only get -one- result from the
grep--the very first one, if the pattern isn't unique. Technically you
should be using something unique, but if you don't by accident, this will
prevent it from acting oddly.
mark->.
--
Bring the web-enabling power of OneGate to -your- filePro applications today!
Try the live filePro-based, OneGate-enabled demo at the following URL:
http://www2.onnik.com/~fairlite/flfssindex.html
More information about the Filepro-list
mailing list