Insertar saltos de pagina en un fichero


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Insertar saltos de pagina en un fichero
# 1  
Old 10-28-2009
Insertar saltos de pagina en un fichero

Hi,
I need help urgently.
Something that seems simple, does not come out.
Attempt to insert into a text file page breaks. I need that the execution is fast (as I have to change many files and very large).

I have tried using the sed command to replace the characters "C$" with "\f"C$, but there is no way, doing it this way:

sed 's/C\$/&\f+/g' prova.txt

It does not work because it replaces the characters "C$" for "f+".

Please, this should be very easy anyone can help me? Smilie

Last edited by e437109; 10-28-2009 at 09:43 AM..
# 2  
Old 10-28-2009
Try this:

Code:
sed 's/C\$/f+/g' file

# 3  
Old 10-28-2009
Data

I've tried and not working


Image
# 4  
Old 10-28-2009
Code:
FF=`echo "\0014\n"` # Form feed
sed -e "s/C\$/${FF}/g" oldfile > newfile

If this doesn't work, please post the output from the diagnostic view of an example end of page record displayed with the following command:

Code:
sed -n l filename

This should reveal if what you see as "C$" is actually something else?
# 5  
Old 10-28-2009
Code:
nawk '{gsub("C\\$", "\f&");print}' myFile

# 6  
Old 10-29-2009
has worked!!

many thanks !! Smilie

---------- Post updated at 05:32 AM ---------- Previous update was at 05:29 AM ----------

It worked but performs the operation in various parts:

FF=`echo "\0014\n"` # Form feed
sed 's/C\$/PAGINAnova&/g' file1> file2
sed -e "s/PAGINAnova/${FF}/g" file2 > file3


many thanks !!

---------- Post updated at 05:33 AM ---------- Previous update was at 05:32 AM ----------

has worked!!

many thanks !!
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Dividir fichero en numero de lineas

Hola, Estoy haciendo un script y queria de un archivo por ejemplo de 650 lineas, recortarlo y hacer archivos mas pequeños de 100 lineas, y que me salieran 7 archivos, por poner un ejemplo. No tengo ni idea de hacerlo la verdad....xD Un saludo y gracias! (3 Replies)
Discussion started by: uri_crack
3 Replies

2. Shell Programming and Scripting

Necesito la fecha de creacion, modificacion y ultimo acceso de un fichero!

Hola, no se casi nada de linux pero tengo que hacer un tp para la facultad, y uno de los puntos me pide que muestre en pantalla la fecha de creacion , modificacion y ultimo acceso de un fichero pasado por parametro a un script.:confused: Alguien me ayuda!? gracias. (1 Reply)
Discussion started by: palitodlselva
1 Replies
Login or Register to Ask a Question