Sponsored Content
Top Forums Shell Programming and Scripting Dividir fichero en numero de lineas Post 302427887 by albertogarcia on Tuesday 8th of June 2010 07:46:24 AM
Old 06-08-2010
Hello uri_crack

try with this:

Code:
num_lineas=1
contador_fichero=0
IFS='
'
while read linea
do
   echo "$linea" >> fichero_salida$contador_fichero
   if [ $num_lineas -eq 100 ]; then
      num_lineas=0
      contador_fichero=$(($contador_fichero+1))
   else
      num_lineas=$(($num_lineas+1))
   fi
done < FICHERO_ENTRADA

 

7 More Discussions You Might Find Interesting

1. HP-UX

Numero de Discos Espelhados (Mirroring) em HP-UX

Gostaria que me ajudassem como pesquisar em HP-UX: -Se ha discos espelhados -Quantos sao e o respectivo espaco ocupado (1 Reply)
Discussion started by: cgege
1 Replies

2. Shell Programming and Scripting

Comparar 2 archivos y agregas lineas faltantes

Hi I have 2 files where i save the IP adress of many printers that work on UNIX, one of these files, which is the 'Main File', is on a server call PROD, and the other one is on a different server call Al. What I want, is to make a comparison between the 2 files, and then, copy the IPs that... (4 Replies)
Discussion started by: Athlon1
4 Replies

3. 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

4. Shell Programming and Scripting

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... (5 Replies)
Discussion started by: e437109
5 Replies

5. Shell Programming and Scripting

Eliminar lineas con ******

Hola. Tengo un problema. En un archivo tengo distintos campos y en alguno de ellos y en alguna linea me aparecen ******. ej: hola 0.1 ****** 85 adios 1.2 9650 23 gracias 2 ****** 54 bye 87 5666 89 hi ... (1 Reply)
Discussion started by: kekaes
1 Replies

6. Shell Programming and Scripting

Eliminar lineas con SED en Bash?

Hola a todos les cuento que estoy haciendo un programa en bash y queria saber como puedo hacer para borrar lineas de un documento de las palabras que NO terminen en S con SED, es decir, mostrar solamente las que terminan con la letra S. les cuento que probe con: sed -e /$.*/d "$archivo" |... (1 Reply)
Discussion started by: adiegorpc
1 Replies

7. Shell Programming and Scripting

Comando seleccionar(selecionar) lineas(Linhas)

Hola, he empezado la carrera de informática y tengo que hacer uno ejercicios con Cygwin ( mismos comandos que UNIX ). Y en el ejercicio me dice que tengo que abrir un archivo .csv y que selecione las lineas en que en la tercera columna el valor sea 4 y en la cuarta columna el valor sea 2, he... (1 Reply)
Discussion started by: mcanhizares
1 Replies
GOPHER_PARSEDIR(3)							 1							GOPHER_PARSEDIR(3)

gopher_parsedir - Translate a gopher formatted directory entry into an associative array.

SYNOPSIS
array gopher_parsedir (string $dirent) DESCRIPTION
gopher_parsedir(3) parses a gopher formatted directory entry into an associative array. While gopher returns text/plain documents for actual document requests. A request to a directory (such as /) will return specially encoded series of lines with each line being one directory entry or information line. PARAMETERS
o $dirent - The directory entry. RETURN VALUES
Returns an associative array whose components are: o type - One of the GOPHER_XXX constants. o title - The name of the resource. o path - The path of the resource. o host - The domain name of the host that has this document (or directory). o port - The port at which to connect on host. Upon failure, the additional data entry of the returned array will hold the parsed line. EXAMPLES
Example #1 Hypothetical output from gopher://gopher.example.com/ 0All about my gopher site. /allabout.txt gopher.example.com 70 9A picture of my cat. /pics/cat.png gopher.example.com 70 1A collection of my writings. /stories gopher.example.com 70 hThe HTTP version of this site. URL:http://www.example.com gopher.example.com 70 1Mirror of this site in Spain. / gopher.ejemplo.co.es 70 iWelcome to my gopher site. error.host 1 iPlease select one of the options above error.host 1 iSend complaints to /dev/null error.host 1 iLong live gopher! error.host 1 In the example above, the root directory at gopher.example.com knows about one DOCUMENT identified by 0 located at gopher://gopher.exam- ple.com:70/allabout.txt. It also knows about two other directory (which have their own listing files) at gopher://gopher.exmaple.com:70/stories and at gopher://gopher.ejemplo.co.es:70/. In addition there is a binary file, a link to an HTTP url, and several informative lines. By passing each line of the directory listing into gopher_parsedir(3), an associative array is formed containing a parsed out version of the data. Example #2 Using gopher_parsedir(3) <?php $directory = file("gopher://gopher.example.com"); foreach($directory as $dirent) { print_r(gopher_parsedir($dirent)); } ?> The above example will output: Array ( [type] => 0 [title] => All about my gopher site. [path] => /allabout.txt [host] => gopher.example.com [port] => 70 ) Array ( [type] => 9 [title] => A picture of my cat. [path] => /pics/cat.png [host] => gopher.example.com [port] => 70 ) Array ( [type] => 1 [title] => A collection of my writings. [path] => /stories [host] => gopher.example.com [port] => 70 ) Array ( [type] => 254 [title] => The HTTP version of this site. [path] => URL:http://www.example.com [host] => gopher.example.com [port] => 70 ) Array ( [type] => 1 [title] => Mirror of this site in Spain. [path] => / [host] => gopher.ejemplo.co.es [port] => 70 ) Array ( [type] => 255 [title] => Welcome to my gopher site. [path] => [host] => error.host [port] => 1 ) Array ( [type] => 255 [title] => Please select one of the options above. [path] => [host] => error.host [port] => 1 ) Array ( [type] => 255 [title] => Send complaints to /dev/null [path] => [host] => error.host [port] => 1 ) Array ( [type] => 255 [title] => Long live gopher! [path] => [host] => error.host [port] => 1 ) PHP Documentation Group GOPHER_PARSEDIR(3)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy