Operating System - HP-UX
1748202 Members
3076 Online
108759 Solutions
New Discussion юеВ

Re: Some question on HP Unix 9000

 
SOLVED
Go to solution
subrata  Sur
Frequent Advisor

Some question on HP Unix 9000

I have the following question about unix please help me to solve the following ...

1) I want to know the memory usage (cpu usage ) of a particular process which top was not shown . What will be the command ?
2) i want to schedule a job which should be running between 6.30 to 8.30 about a interval of 30 mins from monday to friday . how it can be schedule in one go ?
3) what is the diff between at and crontab command ?
4) what is the command for bigger file size in dir and sub directory ?
5) i want to cut from 100 lines to end of the file and want to save it in another file in one go . What will be the command ?
Thanx in advance
17 REPLIES 17
Piergiacomo Perini
Trusted Contributor

Re: Some question on HP Unix 9000

Hi subrata,

1) try this one :
ps -elf | grep
and take SZ column (for RAM used) or TIME column (for CPU usage);
3) "at" run once a time ; "crontab" skedule a job to run periodically;
4) please , specify better what do you mean with ;
5) if file is not too big, with "vi" you can cut lines from 100 to the end and write them in another file (see "vi").

Hoper this help
regards
pg

And as Peter Godron says

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
on how to reward any useful answers given to your questions.
Yogeeraj_1
Honored Contributor

Re: Some question on HP Unix 9000

hi

2) i want to schedule a job which should be running between 6.30 to 8.30 about a interval of 30 mins from monday to friday . how it can be schedule in one go ?

#*******************************************************************************
00,30 06-18 * * 1-5 /home/yogeeraj/myscript.sh 1>/home/yogeeraj/logfiles/output-myscript.crn 2>/home/yogeeraj/logfiles/error-myscript.crn
#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************

**Unfortunately, as it is above it will also run at 6:00 a.m. You should add the test condition in your script so that the 6:00 am. execution just exit the program.

hope this helps!
kind regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
subrata  Sur
Frequent Advisor

Re: Some question on HP Unix 9000


Still i have not exactly got the answer for the following :
1) after issuing the command I have the following output :

$ ps -elf |grep 28763
1 R oracle 28763 1 254 241 20 dd84900 6126 - 08:
35:37 ? 2:17 oracleg036p (LOCAL=NO)sleep 5:02 54.71 54.61 oracleg030p
1 S gcs03t 28933 29620 2 154 20 1d282500 20 1f0800aa 08:3
9:12 pts/tc 0:00 grep 28763

How to know the memory status of the following pid ?

2 )??

3) Is there any command where i can view the biggere file size in my dir and sub directory ?

5) I can do it in vi by issuing :3,$w file name But i want to do it without manual intervention
Regds,
Subrata
Yogeeraj_1
Honored Contributor

Re: Some question on HP Unix 9000

hi again,

4) what is the command for bigger file size in dir and sub directory ?

one quick and dirty way that just came to my mind:

ls -alR |sort +4 -5nr |head -1


hope this helps too!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Piergiacomo Perini
Trusted Contributor

Re: Some question on HP Unix 9000

Hi again,

1) it's then ten column ( "6126" in your example);

5) try if it's possible with "sed".

hth
besta regards
pg
Yogeeraj_1
Honored Contributor
Solution

Re: Some question on HP Unix 9000

hi again,

5) i want to cut from 100 lines to end of the file and want to save it in another file in one go . What will be the command ?

split -l $(expr $(wc -l originfile.txt | cut -c1-5) - 100) originfile.txt newfile.txt

E.g.
============
$split -l $(expr $(wc -l originfile.txt | cut -c1-5) - 100) originfile.txt newfile.txt
$ll
-rw-r--r-- 1 yogeeraj users 206361 May 28 17:20 newfile.txtaa
-rw-r--r-- 1 yogeeraj users 7395 May 28 17:20 newfile.txtab
$ wc -l originfile.txt
2730 originfile.txt
$ wc -l newfile.txtaa
100 newfile.txtaa
$ wc -l newfile.txtab
2630 newfile.txtaa
$

Hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: Some question on HP Unix 9000

hi again!

sorry. my last script contains a BUG!

cut -c1-5

Assumes that the figure obtained does not exceed a 5 digits figure for the count of number of lines in the file.

So be warned. Maybe other can find the right command and modify this for me.


sorry again

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Piergiacomo Perini
Trusted Contributor

Re: Some question on HP Unix 9000

hi again,

for point 5)
i tried another way to do that:
with the command

vi - your_file < mod_file.vi

where mod_file.vi is

:100,$w new_file

hth
best regards
pg
Dennis Handly
Acclaimed Contributor

Re: Some question on HP Unix 9000

>Yogeeraj: split -l ...

I'm not sure split(1) will really work since it's job is to make a bunch of files, covering the whole file.

Instead of using split, there is a command to do exactly what Subrata wants:
$ tail -n +100 file1 > file2
(If you want line 100, you may have to use +99.)

>Yogeeraj: Assumes that the figure obtained does not exceed a 5 digits figure for the count of number of lines in the file.

It's pretty simple, don't use cut(1) (or use cut -f 1), fix wc:
... $(wc -l < originfile.txt)

>pg: vi - your_file < mod_file.vi

I'm not sure why you would want to use vi for batch, that's what ex(1) is for. But sed(1) would also work:
$ sed -n -e '100,$p' your_file > new_file