Below is the command to redirect psql output to a file.
psql> \o /tmp/file.txt
psql> select * from table
This should allow output to custom file.
About Me
Showing posts with label file. Show all posts
Showing posts with label file. Show all posts
Thursday, 24 September 2009
Tuesday, 26 February 2008
To split and analyze the log files.
When ever the log file size is more, Try splitting it and view the file!
Calculate the length of the log file
wc -l log-file.log
Then split the file based on the total number of lines.
For ex Consider the no of lines as 1000, then we can split in to files of 100 lines using below command.
split -l100 log-file.log log-file.log.
This will result in multiple files of 100 lines each. The name of files would be appended by aa,ab,....
To rejoin the file use below command
$ cat log-file.log.* >lastweek.mp3
Calculate the length of the log file
wc -l log-file.log
Then split the file based on the total number of lines.
For ex Consider the no of lines as 1000, then we can split in to files of 100 lines using below command.
split -l100 log-file.log log-file.log.
This will result in multiple files of 100 lines each. The name of files would be appended by aa,ab,....
To rejoin the file use below command
$ cat log-file.log.* >lastweek.mp3
Subscribe to:
Posts (Atom)
