jueves, 24 de enero de 2008

DARWIN II

echo "Hola": lo que hace es que en el siguiente renglon responde lo que pusimos.
Es poco util en la mayoria de los casos pero es util dentro de Unix para poner variables.
Tambien se pueden utilizar constantes a nivel prompt.
EJEMPLO:

L504:~ alumno$ echo "Hola"
Hola
L504:~ alumno$ echo "Hola $USER"
Hola alumno
L504:~ alumno$

Cat: (proviene de concatenar=unir) muestra e contenido de un archivo sin tener que abrirlo y si tengo 2 archivo cat lo que hará es juntar el contenido de ambos en un solo archivo.

EJEMPLO: ¿Qué se debe hacer para que CAT coloque al inicio de cada renglon un numero consecutivo iniciando con el 1?
Sistema Operativo Unix

cat -n file.txt
1 HOLA
2 Sistema Operativo Unix
3 Sistema Operativo Unix
4 ADIOSL504:~/desktop alumno$

Para poder entrar en el manual se coloca "man cat" y te muestra toda su funcionalidad y comandos:
CAT(1) BSD General Commands Manual CAT(1)

NAME
cat -- concatenate and print files

SYNOPSIS
cat [-benstuv] [-] [file ...]

DESCRIPTION
The cat utility reads files sequentially, writing them to the standard
output. The file operands are processed in command line order. A single
dash represents the standard input.

The options are as follows:

-b Implies the -n option but doesn't number blank lines.

-e Implies the -v option, and displays a dollar sign (`$') at the
end of each line as well.

-n Number the output lines, starting at 1.

-s Squeeze multiple adjacent empty lines, causing the output to be

No hay comentarios: