Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 4th, 2012, 04:17 AM
imagenesis imagenesis is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 201 imagenesis User rank is Corporal (100 - 500 Reputation Level)imagenesis User rank is Corporal (100 - 500 Reputation Level)imagenesis User rank is Corporal (100 - 500 Reputation Level)imagenesis User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 1 h 40 m 15 sec
Reputation Power: 8
Awk xargs kill, illegal pid what's wrong?

I have the following code. On cygwin I get the following erros:

$ torak
kill: illegal pid: User
kill: illegal pid: cons0
kill: illegal pid: 05:12:32
kill: illegal pid: /cygdrive/s/_flash/Motion-Twin/neko/neko

alias torak="ps -ef | awk '/cygdrive\/s\/_flash\/Motion\-Twin\/neko\/neko/{print $2}' | xargs kill"

What is the problem?

Reply With Quote
  #2  
Old May 4th, 2012, 08:26 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,107 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 3 h 57 m 31 sec
Reputation Power: 1485
What happens if you run the command without the final pipe into xargs by hand?
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
  #3  
Old May 4th, 2012, 06:25 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,233 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 11 m 5 sec
Reputation Power: 4445
Maybe it's a line termination problem, you could try xargs -0

Just a guess.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #4  
Old May 6th, 2012, 05:41 PM
imagenesis imagenesis is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Posts: 201 imagenesis User rank is Corporal (100 - 500 Reputation Level)imagenesis User rank is Corporal (100 - 500 Reputation Level)imagenesis User rank is Corporal (100 - 500 Reputation Level)imagenesis User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 1 h 40 m 15 sec
Reputation Power: 8
@Doug It may be but i dont replacing it with null characters would be relevant in this case.

The output of the awk is:

Quote:
$ ps -ef | awk '/cygdrive\/s\/_flash\/Motion\-Twin\/neko\/neko/{print $2}'
7184



Executing echo "6712" | xargs kill works

The output of:

echo "hello world" | awk '/hello/{print $1}' is

Quote:
hello


Last edited by imagenesis : May 6th, 2012 at 05:56 PM.

Reply With Quote
  #5  
Old May 8th, 2012, 05:30 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,107 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 3 h 57 m 31 sec
Reputation Power: 1485
I may have it. It's down to it being an alias - when you define it the variable $2 does not contain a value, so the alias value is invalid. Quote the $ (\$) to prevent it being evaluated at creation time and try that.
<edit>
Yes, that worked for me Use alias -p to see what is defined
</edit>

Last edited by SimonJM : May 8th, 2012 at 05:52 AM. Reason: Tetsed it!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Awk xargs kill, illegal pid what's wrong?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap