Friday, September 25, 2009

Working with text files in Unix/Linux (part 2/3)

The scenario is that you have a compressed file with ZIP, and this is a raw text log file that you have to unzip and then to cat.

$ zcat messages.gz

You want to see only the first lines of a text file, for that is the head command.

$ head messages.log

And if you want to see the line number of a file, use the cat with the -n argument like:
$ cat -n file1.txt

Everything together: 
$ zcat messages.gz | head | cat -n

0 comentarios: