1838340 Members
3073 Online
110125 Solutions
New Discussion

Print option...

 
Thi Vu
Frequent Advisor

Print option...

Hi,

I hope someone can help me with this problem.

I have a 1000 pages report that need to be printed everyday; however the user only need to see from pg 40-100. The set up of the report is :

COL1 (\t) COL1 (\t) ..... PAGE: #
COL1 .................... CLIENT PAGE: #

I'd tried:

sed -n '40,100p' filename
but it only print LINE 40 -100 not page. I even tried:

sed -n '/PAGE; 40/,/PAGE: 100/'p filename
but sed complains "sed : function /PAGE: 40/ /PAGE: 100/ can not be parse.

Any help is greatly appreciate.
Thanks
5 REPLIES 5
Rita C Workman
Honored Contributor

Re: Print option...

I don't know if you want to try this - but - why not just email the file as an attachment so that the user can then review and print from their PC what they want printed..

Here's a good thread on this:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x41950559ff7cd4118fef0090279cd0f9,00.html

Just a thought,
Rodney Hills
Honored Contributor

Re: Print option...

I think your idea of 'sed' was ok, but did your check your syntax? Should be--

sed -n '/PAGE: 40/,/PAGE: 100/p'
I successfully ran this on hpux 10.20
There be dragons...
Thi Vu
Frequent Advisor

Re: Print option...

Re: Answers/Suggestions ..

1st. Email was not an option. If only ....

2nd. the command did not work either - there was no complain this time about parse error. It just jump back to the promt.

Tracey
Trusted Contributor

Re: Print option...

If your pages are a uniform length (say 60 lines long), could you do:
split -l 1200

to split it into multiple files of 1200 lines (20 pages) long, then cat the 3rd-5th files together and print the resultant file.

I know... going the long way around, but it may work.
Thi Vu
Frequent Advisor

Re: Print option...

Hi there again,

I had been working on this problem since I last posted the question and "solve" the problem - HALF way. This is what I did

awk '$NF ~ /^40$/,/^100$/ { print $0 }' FILE

It printed form pg 40 to the end of the report.

Thank you in advance for your assistant.