I wanted to ask one thing which is not related to this thread . I appologize
for that as it is very small thing so making another thread was no worth.
i wanted to no that if i have file like abc.jpg is there a command which can
just give me the name abc without extension or do i need to make a script
for doing this actually i need to rename them from abc.exe to abc.jpg 100's
of files.

Regards

2008/11/7 narendra sisodiya <[EMAIL PROTECTED]>

> Thanks Yaar,
> Actually,, One of my friend was wanted to have this thing because he wanted
> to automate some process. I am not good at bash, I made a "just-running"
> code and shared so that other can improve,,,
> Your reply is much better.
> I will modify code.
>
> 2008/11/7 Phani Bhushan Tholeti <[EMAIL PROTECTED]>
>
> never thought ppl would need this. Here's what I use:
>>
>> ps| grep $LOGNAME | awk '{ if (index($0,"gvim") && index($8,"awk")==0)
>> print $2}'
>>
>> ps - get processes
>> grep - remove other users' processes (just in case)
>> awk - very ineffecient usage, but works - just get  the second column for
>> those rows where the process (gvim) in this case is running and not awk
>>
>> pipe to kill :
>> ps| grep $LOGNAME | awk '{ if (index($0,"gvim") && index($8,"awk")==0)
>> print $2}' | xargs kill
>>
>> while we are on it, here's one more to copy certain type of files to some
>> directory
>> find ./ -name *.ext | xargs -I {} cp {} <target dir>
>>
>>
>> Possible and required improvement
>> get details from command line rather than hard coding
>>
>> ps| grep $LOGNAME | awk '{ if (index($0,"gvim") && index($8,"awk")==0)
>> print $2}' | xargs kill
>>
>> Here are a few more I use:
>>
>>
>> 2008/11/7 narendra sisodiya <[EMAIL PROTECTED]>
>>
>> This is a very simple try, please extend and republish it
>>>
>>> Task : killing process by "patten matching in ps -ef"
>>>
>>> $ vi kill_grep
>>>
>>> paste this
>>>
>>> #!/bin/bash
>>> kill -9  $(ps -ef | grep $1 | cut -c9-15 | head -n-1)
>>> exit 0
>>>
>>> chmod +x kill_grep
>>> cp kill_grep /bin
>>>
>>>
>>> now you can kill process by name itself,,
>>> like
>>>
>>> $ kill_grep gftp
>>>
>>> will kill all gftp instance ...
>>>
>>>
>>>
>>> -- released in public domain, please extend this to make it a good
>>> utility,,
>>>
>>> PS: this is made for new user or like me who want to type less or
>>> automate. not for command line Geeks.
>>> --
>>> ┌───[ Narendra Sisodiya ]──────────────┐
>>> │     http://narendra.techfandu.org
>>> │     http://www.lug-iitd.org
>>> └─new number ───[ +91-93121-66995 ]──────┘
>>>
>>>
>>>
>>
>>
>> --
>> Lots o' Luv,
>> Phani Bhushan
>>
>> Let not your sense of morals prevent you from doing what is right - Isaac
>> Asimov (Salvor Hardin in Foundation and Empire)
>>
>>
>>
>
>
> --
> ┌───[ Narendra Sisodiya ]──────────────┐
> │     http://narendra.techfandu.org
> │     http://www.lug-iitd.org
> └─new number ───[ +91-93121-66995 ]──────┘
>
> >
>


-- 
Join the next generation of computing, Open Source, and Linux/GNU!

Harsimran singh walia
3rd year, Mechanical Engineering
IIT Delhi

--~--~---------~--~----~------------~-------~--~----~
[EMAIL PROTECTED] mailing list -- group http://groups.google.com/group/iitdlug
-~----------~----~----~----~------~----~------~--~---

Reply via email to