script for adding page number before page breaks


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for adding page number before page breaks
# 8  
Old 09-21-2012
Quote:
Originally Posted by antman
I see in the awk documentation the form feed character can be expressed as \f .
Code:
awk '/^\f/{a++;print "Page N0-"a}1' file

Hope it makes sense...
For adding url - There is option for adding url.

and if the above code you have provided works for you then its great.Smilie

BTW have you tried my suggestions..?
# 9  
Old 09-21-2012
Code:
awk "/^\f/{a++;print \"Page \"a}1" file.txt > out.txt

this worked. I changed the " too, not sure I had to Smilie . I cant add url due to low karma points on the forum, I need five points and I have zero...

---------- Post updated at 04:35 AM ---------- Previous update was at 04:30 AM ----------

Now I have to find how to add [solved] to the thread name...
# 10  
Old 09-21-2012
you can use single quote. so you don't need backslashes.

Code:
awk '/^\f/{a++;print "Page "a}1' file.txt > out.txt

EDIT:
for add [solved] go to edit mode and advanced option....Smilie

Last edited by pamu; 09-21-2012 at 06:56 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: Page number with total number of pages, EG Page 1 of 5

So I've worked how to add page numbers based on regex. It's using the footer text. How do we get the total amount added so we have page number with the total number of pages? Desired output: Page No:1 of 5 Thanks in advance. (15 Replies)
Discussion started by: tugar
15 Replies

2. UNIX for Dummies Questions & Answers

Page breaks and line breaks

Hi All, Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement . Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks . We have... (4 Replies)
Discussion started by: Ayaskant
4 Replies

3. Shell Programming and Scripting

Print multiple copies page by page using lp command

Hi I have a pdf file that is being generated using the rwrun command in the shell script. I then have the lp command in the shell script to print the same pdf file. Suppose there are 4 pages in the pdf file , I need to print 2 copies of the first page, 2 copies of the second page , then 2... (7 Replies)
Discussion started by: megha2525
7 Replies

4. UNIX for Dummies Questions & Answers

display command output page per page

Good afternoon, I wonder how i could use unix commands to ease the reading of long command result output ? like the "php -i" or any other command that returns a long answer. I could not find the right terms to Google it or search the forum. Therefore I bother you with this question. ... (3 Replies)
Discussion started by: Mat_k
3 Replies

5. Shell Programming and Scripting

How to input a number in a web page and pass to a script?

I am working on an embedded linux router and trying to make a webpage where the user can input a desired number of CPE and have a script update that number on the router. I have a CLI where I can log in and type the following to change that number echo "20">/proc/net/dbrctl/maxcpe which then... (7 Replies)
Discussion started by: BobTheBulldog
7 Replies

6. Shell Programming and Scripting

Help on page breaks

Hi, I am new to Unix (AIX). I have a header (in a text file) that needs to be wrtitten on all the pages of a result file (text file). After the header is written, data needs to be read from a file A(text file) and inserted to the result file. If the number of lines reaches 80 in a page, page... (1 Reply)
Discussion started by: simhasuri
1 Replies

7. Shell Programming and Scripting

How to remove page breaks from a flat file???

Hi All, I get a flat file with its last field data splitting onto a new line.I got this program from Vgersh which when run would cancatenate the split data back to the end of the previous records.But this program fails when it encounters a page break between the split data and the previous... (5 Replies)
Discussion started by: kumarsaravana_s
5 Replies

8. UNIX for Dummies Questions & Answers

adding a man page

I was wonderiong if ther is a way for a user to add a man page specific to thier account. similar to copying the .1 or .1.gz to /usr/share/man/man1 "cp *.1.gz /usr/share/man/man1". Except for using another folder as I don't have access to /usr/share/man/man1. I would think that this might involve... (1 Reply)
Discussion started by: jacob358
1 Replies

9. Programming

Page Breaks

Hi, I have a program in Pro*c when I run it I have no problem with the output but when it runs via the at command and except the output has page breaks every 66 lines. I don't want those page breaks to be in the output. any idea? (9 Replies)
Discussion started by: rama71
9 Replies

10. Shell Programming and Scripting

Insert page breaks into .csv file

I have large .csv files that I need to get page breaks into. I am taking comma delimited files of over a million records and putting them into a pdf file. Is there a way, using sed or otherwise, to insert some type of page break character into my file? (2 Replies)
Discussion started by: welsht
2 Replies
Login or Register to Ask a Question