Search Results

Search: Posts Made By: Chiefos
2,414
Posted By Chiefos
How do properties effect script?
Hi,

I have noticed that rm -if will perform completely different to rm -fi. Whats the pattern of how I put my options to the script in relation to how it will act.

i.e

rm -fi treat the...
4,135
Posted By Chiefos
Its ok, i totally understand it now, thank you...
Its ok, i totally understand it now, thank you for all your help. Its a little tricky programming in this single looping manner of awk when youve never done it before.

But actually it will make...
4,135
Posted By Chiefos
Ok, still not understanding. You said: ...
Ok, still not understanding.

You said:



what do you mean "in the array". The first field of the line will be the UID, lets say its 25. Well none of the entries in the array will be "25",...
4,135
Posted By Chiefos
vgersh99, im about 3/4 the way to understanding...
vgersh99, im about 3/4 the way to understanding what your saying. Im going to read and re-read this but i may be back so dont go anywhere :-)
4,135
Posted By Chiefos
Think its primarily this I am having problems...
Think its primarily this I am having problems with:

arr[$1] = ($1 in arr) ? arr[$1] SUBSEP $0 : $0

I just dont know what its saying to me
4,135
Posted By Chiefos
vgersh99, thats almost exactly what I wanted. The...
vgersh99, thats almost exactly what I wanted. The only problem is I dont have a clue what youve done there :-). Could you possibly talk me through some of this.
4,135
Posted By Chiefos
shereenmotor, actually the example of ps -ef i...
shereenmotor, actually the example of ps -ef i gave showd the UID as root, which may make you think that later down the list it would give the other names. But it actually give the ID for the users...
4,135
Posted By Chiefos
Ok basically i want to write a script that...
Ok basically i want to write a script that outputs something like this:

(for each user)
Username
PID TTY Time CMD
(end for each)

so i.e.

James.Brown

PID TTY ...
4,135
Posted By Chiefos
shereenmotor ive not put all of the results but...
shereenmotor ive not put all of the results but you get the idea:

ps -ef:

UID PID PPID C STIME TTY TIME CMD
root 1 0 0 May26 ? 00:00:07 init
root ...
4,135
Posted By Chiefos
Basically: ps -ef This gets me all the...
Basically:

ps -ef

This gets me all the information I need except the username. Though it does return the users ID (UID). I need to know how I reference the username from the UID.


Thanks,...
4,135
Posted By Chiefos
shereenmotor: ps -ef doesnt output the username...
shereenmotor: ps -ef doesnt output the username at all, it does however output the UID, which still doesnt help because I need to link the UID to a username.

grial: ps -O will work, but i dont...
4,135
Posted By Chiefos
Users and processes
Hi All,

I am trying to write a script to list all users and their processes. I cant seem to find out how to link the PID to the user. For example if i run ps -a I get a nice list of all the...
30,415
Posted By Chiefos
ahhh, thanks chief.
ahhh, thanks chief.
30,415
Posted By Chiefos
lol, im back :-). I have no problems printing the...
lol, im back :-). I have no problems printing the results to the screen but i can seem to add them to a file i.e.

for(j=1;J<=i;j++)
{
print Lines[j] > Out
}

Gives me this error:

awk:...
30,415
Posted By Chiefos
nevermind just did for(j=0;J<i;j++) { ...
nevermind just did

for(j=0;J<i;j++)
{
print Lines[j]
}

Ta Chris.
30,415
Posted By Chiefos
Actually i have another problem, i didnt actually...
Actually i have another problem, i didnt actually want to print the line to out put i wanted to save it as an array and print at the end i.e.

BEGIN
{
i=0
}
{
i++
Lines[i]= i ")" $0
}
END...
30,415
Posted By Chiefos
Thanks vgersh99, knew it would be something...
Thanks vgersh99, knew it would be something simple. And ill take a look at printf.

Thanks again, Chris.
30,415
Posted By Chiefos
awk print line
Hi All,

I know that i can print the lines from awk just using the print method, but i need to print stuff before it i.e:


BEGIN
{
i=0
}
{
i++
print i ")"
print
}
END
{
}

Here the...
2,430
Posted By Chiefos
Thanks sssow thats what I was after.
Thanks sssow thats what I was after.
2,430
Posted By Chiefos
Find the user executing a script
How do i in a script determine the user that is executing it?
16,406
Posted By Chiefos
Thanks all
Thanks all
16,406
Posted By Chiefos
Sorry, i thought the new line was accidental. ...
Sorry, i thought the new line was accidental.

Your script shows at the end:

"Your Text Goes here, dont use variable here' NewFile"

How would I use a variable there then? As I said I wanna...
16,406
Posted By Chiefos
Actually, can someone just show me a simple sed...
Actually, can someone just show me a simple sed command for adding "Hello" to a file called "MyFile" at line 5. Forget the scripts just a single command to add the word hello at line 5.

Thanks,...
16,406
Posted By Chiefos
Hi Shereenmoter, I got exactly the same...
Hi Shereenmoter,

I got exactly the same error:

sed: -e expression #1, char 3: Extra characters after command

This is what ive written so far:


#Get the number of lines in the file...
16,406
Posted By Chiefos
I keep getting this error when i try to run the...
I keep getting this error when i try to run the script:

sed: -e expression #1, char 3: Extra characters after command
Showing results 1 to 25 of 28

 
All times are GMT -4. The time now is 05:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy