1753894 Members
7602 Online
108809 Solutions
New Discussion юеВ

Re: Tmp file too large

 
Simon Hargrave
Honored Contributor

Re: Tmp file too large

If you want to shrink the alert log, then use ed: -

# wc -l alert.log
10000
# ed alert.log <1,1000d
w
q
EOF

# wc -l alert.log
9000

eg above the alert log is 10000 lines long. The "ed" script will delete the 1st 1000 lines and save the file.
Simon Hargrave
Honored Contributor

Re: Tmp file too large

Sorry just noticed, ed will not work. From the man page: -

The following size limitations apply: 256 characters per global command list, 64 characters per file name, and 32 MB characters in the buffer.

32MB file size limit.
Simon Hargrave
Honored Contributor

Re: Tmp file too large

Try this, to delete the 1st 1000 lines: -

cp alert.log alert.log.tmp
awk 'NR>1000' alert.log.tmp > alert.log
rm alert.log.tmp
Thayanidhi
Honored Contributor

Re: Tmp file too large

Do a "tail -xxxx > new_name"
Then remove the original name and mv the new_name to original name.

If you want view before you trim use split.

I think you can also do the same in SAM. open routine tasks and logs files. Add your file to list with recommended size. Then you should be able to trim from sam.

Regds
TT
Attitude (not aptitude) determines altitude.
Simon Hargrave
Honored Contributor

Re: Tmp file too large

The problem with tail is it's limited to how many lines it can process, a few thousand if I recall.
Stephen Keane
Honored Contributor

Re: Tmp file too large

tail uses a 20k buffer, anything over that and you are out of luck.
Devesh Pant_1
Esteemed Contributor

Re: Tmp file too large

If you really need to vi the file, here is a good way to do it
The way I liked best of doing this was by using this
command: "split -b 20m target"