Sponsored Content
Top Forums Shell Programming and Scripting How to divide results into several pages? Post 302342832 by Smiling Dragon on Monday 10th of August 2009 11:50:43 PM
Old 08-11-2009
If you are trying to insert a pagebreak every 50 lines, that's not too hard to do in perl:
Code:
$maxlines=50;
$linenum=0;
while (<STDIN>) {
  $linenum++;
  if ($linenum > $maxlines) {
    $linenum=0;
    print "^L";
  }
  print "$_";
}

(Untested)
You'll need to put an actual page break in there where it has ^L (ie don't copy-paste the ^ and the L characters, use a single control-L character).

Should do the job.

You can also do it using perl's rather nice 'format' option Perl format Primer (1/2)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script needs to divide by 2

i need to divide this count by 2, what variable can i use in my script? 26 hcscprod_cpus_totals /2 = 13 13 hcncprod_cpus_totals /2= 6.5 541 ktazp_cpus_totals /2= 270.5 346 ktazd_cpus_totals /2=173 110 ktazi_cpus_totals /2=55 10 ktazq_cpus_totals /2=5 (2 Replies)
Discussion started by: wereyou
2 Replies

2. Shell Programming and Scripting

divide with awk

Dear, i want to devide the first 4 values from a raw over the next 4 values like the following: $1+$2+$3+$4 / $5+$6+$7+$8 using AWK ....can someone help me? Sanks (1 Reply)
Discussion started by: tontal
1 Replies

3. UNIX for Dummies Questions & Answers

divide issue

Hi, I have a issue dividing 2 values in UNIX a=15 b=100 c = a / b ==> and it is returning 0 instead of 0.15 into variable C. How can i resolve this issue ? please help (1 Reply)
Discussion started by: kotasateesh
1 Replies

4. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

5. Shell Programming and Scripting

Divide variable

Hi All, here D Prints the bytes value .plz help to convert the variable D value to MB in new variable $E D=`more $C |awk '{print $6;}'` Thanks in Advance.:) (3 Replies)
Discussion started by: netdbaind
3 Replies

6. Shell Programming and Scripting

Divide two variable

F= `expr $E/$S` output test5.sh: line 45: 1296863.27001857757568359375/21997: No such file or directory can any one help me ,i just want to divide the $E/$S and Print o/p in F. (3 Replies)
Discussion started by: netdbaind
3 Replies

7. Shell Programming and Scripting

Divide by zero script

Hi, I've been working on a few scripts and have been getting great info. How, would I include in the below script, how I would let a user know that if they divide a SECOND number by zero, that they would get a divide by zero error? What's the easiest way of working this? Cordially, joe. ... (1 Reply)
Discussion started by: jefferj54
1 Replies

8. UNIX for Dummies Questions & Answers

To divide file

We have large log files, and we need to extract last four hours lines only, Please let us know the command. Thanks, Saurau. (1 Reply)
Discussion started by: saurau
1 Replies

9. What is on Your Mind?

Moved Advanced Stats to Search Results Pages

FYI, today I moved the "Advanced Stats" page from the forum home page to the search results pages. This means that at the top of the search results like "Today's Post" and "New Posts" and keyword searches, the stats will appear at the top of that page instead of the home page. The reason of... (3 Replies)
Discussion started by: Neo
3 Replies

10. Shell Programming and Scripting

I want to add a variable for the results from the formula of one variable and results of another var

Good morning all, This is the file name in question OD_Orders_2019-02-19.csv I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies
HEADERS_SENT(3) 							 1							   HEADERS_SENT(3)

headers_sent - Checks if or where headers have been sent

SYNOPSIS
bool headers_sent ([string &$file], [int &$line]) DESCRIPTION
Checks if or where headers have been sent. You can't add any more header lines using the header(3) function once the header block has already been sent. Using this function you can at least prevent getting HTTP header related error messages. Another option is to use Output Buffering. PARAMETERS
o $file - If the optional $file and $line parameters are set, headers_sent(3) will put the PHP source file name and line number where out- put started in the $file and $line variables. o $line - The line number where the output started. RETURN VALUES
headers_sent(3) will return FALSE if no HTTP headers have already been sent or TRUE otherwise. EXAMPLES
Example #1 Examples using headers_sent(3) <?php // If no headers are sent, send one if (!headers_sent()) { header('Location: http://www.example.com/'); exit; } // An example using the optional file and line parameters, as of PHP 4.3.0 // Note that $filename and $linenum are passed in for later use. // Do not assign them values beforehand. if (!headers_sent($filename, $linenum)) { header('Location: http://www.example.com/'); exit; // You would most likely trigger an error here. } else { echo "Headers already sent in $filename on line $linenum " . "Cannot redirect, for now please click this <a " . "href="http://www.example.com">link</a> instead "; exit; } ?> NOTES
Note Headers will only be accessible and output when a SAPI that supports them is in use. SEE ALSO
ob_start(3), trigger_error(3), headers_list(3), header(3) for a more detailed discussion of the matters involved. . PHP Documentation Group HEADERS_SENT(3)
All times are GMT -4. The time now is 07:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy