Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #14620 > unrolled thread

List files being edited ?

Started byno.top.post@gmail.com
First post2015-04-24 03:29 +0000
Last post2015-06-17 03:53 +0000
Articles 10 — 7 participants

Back to article view | Back to comp.os.linux.misc


Contents

  List files being edited ? no.top.post@gmail.com - 2015-04-24 03:29 +0000
    Re: List files being edited ? Joe Beanfish <joebeanfish@nospam.duh> - 2015-04-24 14:53 +0000
      Re: List files being edited ? no.top.post@gmail.com - 2015-04-25 08:59 +0000
        Re: List files being edited ? William Unruh <unruh@invalid.ca> - 2015-04-25 14:34 +0000
          Re: List files being edited ? Helmut@Hullen.de (Helmut Hullen) - 2015-04-25 18:26 +0200
          Re: List files being edited ? Unknown <dog@gmail.com> - 2015-06-15 13:58 +0000
            Re: List files being edited ? William Unruh <unruh@invalid.ca> - 2015-06-15 15:37 +0000
              Re: List files being edited ? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2015-06-15 20:10 +0300
            Re: List files being edited ? "Anonymous Remailer (austria)" <mixmaster@remailer.privacy.at> - 2015-06-15 20:51 +0200
              Re: List files being edited ? William Unruh <unruh@invalid.ca> - 2015-06-17 03:53 +0000

#14620 — List files being edited ?

Fromno.top.post@gmail.com
Date2015-04-24 03:29 +0000
SubjectList files being edited ?
Message-ID<mhcdbc$vnf$1@dont-email.me>
lsof | grep mcedit | grep cwd | awk '{print $2}'
  shows you the PID of all mcedit.

less /proc/$mceditPIDs/cmdline
  shows you the files being edited by mcedit,
   for a valid $mceditPIDs.

What's the script to list all the files <open under mcedit>?

It's for human consuption, so need not be 'clean';
eg. less /proc/11549/cmdline
  shows me
mcedit-b/var/CONTROL/CIPCstik
 where I don't know what the "-b" is,
but I can see that CIPCstik is already open for editing,
in possibly another of the 22 WorkSpaces.
So I should not open another copy.


== TIA.

PS. old blackbox is a killer WindowManager:
  Alt/<anyKey> can launch any program,
including opening an editor on your <notes file/s>.

[toc] | [next] | [standalone]


#14621

FromJoe Beanfish <joebeanfish@nospam.duh>
Date2015-04-24 14:53 +0000
Message-ID<mhdle4$4j6$1@dont-email.me>
In reply to#14620
On Fri, 24 Apr 2015 03:29:49 +0000, no.top.post wrote:
> What's the script to list all the files <open under mcedit>?
> It's for human consuption, so need not be 'clean';

Perhaps

awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline

Of course that assumes the user hasn't switched files since
starting mcedit.

The [t] after mcedi prevents awk from matching itself.
Also print FILENAME if you want the PID of the process.

[toc] | [prev] | [next] | [standalone]


#14626

Fromno.top.post@gmail.com
Date2015-04-25 08:59 +0000
Message-ID<mhfl1e$98f$1@dont-email.me>
In reply to#14621
In article <mhdle4$4j6$1@dont-email.me>, Joe Beanfish <joebeanfish@nospam.duh> wrote: 

> On Fri, 24 Apr 2015 03:29:49 +0000, no.top.post wrote:
> > What's the script to list all the files <open under mcedit>?
> > It's for human consuption, so need not be 'clean';
> 
> Perhaps
> 
> awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline

! Amazing !!
? List all mcedi in  /proc/*/cmdline ?

Without yet understanding the details, I can imediately USE that,
to popup NoteFiles for the critical jobs, while navigating any of
the 2-dozen workspaces. 
blackbox:WindowManager's ability to make the NoteFiles sticky
[follow to all WS] is problematic.

> Of course that assumes the user hasn't switched files since
> starting mcedit.
> 
> The [t] after mcedi prevents awk from matching itself.
> Also print FILENAME if you want the PID of the process.

First I'll need to understand/refresh awk basics.

A related problem that I've been looking to solve for 10 years:--
It's an error to umount, eg. a USBstik which has its inactive
[one of two] panel of mc on the USBstik's path.

   for Mpath in `pgrep mc`; do 
       lsof | grep $Mpath | grep cwd |awk '{print $2 ":" $9}'; done
show me the path that each mc is <active on>.

If mc in WorkSpace-21 is 'holding' the path and is covered by another 
<Frame>, it's a big problem to manually uncover & search all the mc/s.

Obviously mc-internally knows the inactive-Panel's path for each pid,
but is seems that /proc/* and lsof doesn't.

Thanks for another great tool to help navigate lifes chaos.

[toc] | [prev] | [next] | [standalone]


#14627

FromWilliam Unruh <unruh@invalid.ca>
Date2015-04-25 14:34 +0000
Message-ID<mhg8m1$b2q$1@dont-email.me>
In reply to#14626
On 2015-04-25, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
> In article <mhdle4$4j6$1@dont-email.me>, Joe Beanfish <joebeanfish@nospam.duh> wrote: 
>
>> On Fri, 24 Apr 2015 03:29:49 +0000, no.top.post wrote:
>> > What's the script to list all the files <open under mcedit>?
>> > It's for human consuption, so need not be 'clean';
>> 
>> Perhaps
>> 
>> awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline

Or 
ps auxww |grep mcedit|grep -v grep
I have that as an alias
function psg () { ps axww -o "%U %G %p %C %z %y %t  %x %a"| egrep $*\|'^USER '| grep -v grep ;}
>
> ! Amazing !!
> ? List all mcedi in  /proc/*/cmdline ?
>
> Without yet understanding the details, I can imediately USE that,
> to popup NoteFiles for the critical jobs, while navigating any of
> the 2-dozen workspaces. 
> blackbox:WindowManager's ability to make the NoteFiles sticky
> [follow to all WS] is problematic.
>
>> Of course that assumes the user hasn't switched files since
>> starting mcedit.
>> 
>> The [t] after mcedi prevents awk from matching itself.
>> Also print FILENAME if you want the PID of the process.
>
> First I'll need to understand/refresh awk basics.
>
> A related problem that I've been looking to solve for 10 years:--
> It's an error to umount, eg. a USBstik which has its inactive
> [one of two] panel of mc on the USBstik's path.
>
>    for Mpath in `pgrep mc`; do 
>        lsof | grep $Mpath | grep cwd |awk '{print $2 ":" $9}'; done
> show me the path that each mc is <active on>.
>
> If mc in WorkSpace-21 is 'holding' the path and is covered by another 
><Frame>, it's a big problem to manually uncover & search all the mc/s.
>
> Obviously mc-internally knows the inactive-Panel's path for each pid,
> but is seems that /proc/* and lsof doesn't.
>
> Thanks for another great tool to help navigate lifes chaos.
>

[toc] | [prev] | [next] | [standalone]


#14628

FromHelmut@Hullen.de (Helmut Hullen)
Date2015-04-25 18:26 +0200
Message-ID<DFYCshZy1uB@helmut.hullen.de>
In reply to#14627
Hallo, William,

Du meintest am 25.04.15:

>>>> What's the script to list all the files <open under mcedit>?
>>>> It's for human consuption, so need not be 'clean';

>>> Perhaps
>>>
>>> awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline

> Or
> ps auxww |grep mcedit|grep -v grep
> I have that as an alias
> function psg () { ps axww -o "%U %G %p %C %z %y %t  %x %a"| egrep

or (since many years)

        pgrep -l -x mcedit

(perhaps with some additional options).

Viele Gruesse
Helmut

"Ubuntu" - an African word, meaning "Slackware is too hard for me".

[toc] | [prev] | [next] | [standalone]


#14942

FromUnknown <dog@gmail.com>
Date2015-06-15 13:58 +0000
Message-ID<pan.2015.06.15.13.59.50@gmail.com>
In reply to#14627
On Sat, 25 Apr 2015 14:34:41 +0000, William Unruh wrote:

> On 2015-04-25, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
>> In article <mhdle4$4j6$1@dont-email.me>, Joe Beanfish
>> <joebeanfish@nospam.duh> wrote:
>>
>>> On Fri, 24 Apr 2015 03:29:49 +0000, no.top.post wrote:
>>> > What's the script to list all the files <open under mcedit>? It's
>>> > for human consuption, so need not be 'clean';
>>> 
>>> Perhaps
>>> 
>>> awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline
> 
> Or
> ps auxww |grep mcedit|grep -v grep
> I have that as an alias
> function psg () { ps axww -o "%U %G %p %C %z %y %t  %x %a"| egrep
> $*\|'^USER '| grep -v grep ;}

IMO one-line-ism is a BAD habit.
This is completely out of control.

--snip--
>>> Of course that assumes the user hasn't switched files since starting
>>> mcedit.

?? The whole aim is to be able to look back-in-history, since the user
MULTIPLY "switched files since starting mcedit"?!

--snip --

[toc] | [prev] | [next] | [standalone]


#14944

FromWilliam Unruh <unruh@invalid.ca>
Date2015-06-15 15:37 +0000
Message-ID<mlmrfl$k33$1@dont-email.me>
In reply to#14942
On 2015-06-15, Unknown <dog@gmail.com> wrote:
> On Sat, 25 Apr 2015 14:34:41 +0000, William Unruh wrote:
>
>> On 2015-04-25, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
>>> In article <mhdle4$4j6$1@dont-email.me>, Joe Beanfish
>>> <joebeanfish@nospam.duh> wrote:
>>>
>>>> On Fri, 24 Apr 2015 03:29:49 +0000, no.top.post wrote:
>>>> > What's the script to list all the files <open under mcedit>? It's
>>>> > for human consuption, so need not be 'clean';
>>>> 
>>>> Perhaps
>>>> 
>>>> awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline
>> 
>> Or
>> ps auxww |grep mcedit|grep -v grep
>> I have that as an alias
>> function psg () { ps axww -o "%U %G %p %C %z %y %t  %x %a"| egrep
>> $*\|'^USER '| grep -v grep ;}
>
> IMO one-line-ism is a BAD habit.
> This is completely out of control.

What are you talking about. One of the key features of Linux is the
ability to piece together small programs which do one thing well into
programs that do what you want. If you have a better way of
accomplishing what that does, please let me know. Using a bunch of
temporary variables to accomplish what a pipe does is, in my mind, a BAD
habit.

>
> --snip--
>>>> Of course that assumes the user hasn't switched files since starting
>>>> mcedit.
>
> ?? The whole aim is to be able to look back-in-history, since the user
> MULTIPLY "switched files since starting mcedit"?!

No idea what that sentence means. 
There is nothing that maintains a history, and nothing except mcedit
itself that knows what it is editing now. 
Maybe you need to rething what you want.

>
> --snip --

[toc] | [prev] | [next] | [standalone]


#14945

FromTauno Voipio <tauno.voipio@notused.fi.invalid>
Date2015-06-15 20:10 +0300
Message-ID<mln0s4$c88$1@dont-email.me>
In reply to#14944
On 15.6.15 18:37, William Unruh wrote:
> On 2015-06-15, Unknown <dog@gmail.com> wrote:
>> On Sat, 25 Apr 2015 14:34:41 +0000, William Unruh wrote:
>>
>>> On 2015-04-25, no.top.post@gmail.com <no.top.post@gmail.com> wrote:
>>>> In article <mhdle4$4j6$1@dont-email.me>, Joe Beanfish
>>>> <joebeanfish@nospam.duh> wrote:
>>>>
>>>>> On Fri, 24 Apr 2015 03:29:49 +0000, no.top.post wrote:
>>>>>> What's the script to list all the files <open under mcedit>? It's
>>>>>> for human consuption, so need not be 'clean';
>>>>>
>>>>> Perhaps
>>>>>
>>>>> awk '/mcedi[t]/{gsub("\0"," ");print}' /proc/*/cmdline
>>>
>>> Or
>>> ps auxww |grep mcedit|grep -v grep
>>> I have that as an alias
>>> function psg () { ps axww -o "%U %G %p %C %z %y %t  %x %a"| egrep
>>> $*\|'^USER '| grep -v grep ;}
>>
>> IMO one-line-ism is a BAD habit.
>> This is completely out of control.
>
> What are you talking about. One of the key features of Linux is the
> ability to piece together small programs which do one thing well into
> programs that do what you want. If you have a better way of
> accomplishing what that does, please let me know. Using a bunch of
> temporary variables to accomplish what a pipe does is, in my mind, a BAD
> habit.
>
>>
>> --snip--
>>>>> Of course that assumes the user hasn't switched files since starting
>>>>> mcedit.
>>
>> ?? The whole aim is to be able to look back-in-history, since the user
>> MULTIPLY "switched files since starting mcedit"?!
>
> No idea what that sentence means.
> There is nothing that maintains a history, and nothing except mcedit
> itself that knows what it is editing now.
> Maybe you need to rething what you want.
>
>>
>> --snip --

You're wasting your gunpowder to crows ...

'Unknown' (and at least a dozen of side personalities) is a known troll.

-- 

-TV

[toc] | [prev] | [next] | [standalone]


#14947

From"Anonymous Remailer (austria)" <mixmaster@remailer.privacy.at>
Date2015-06-15 20:51 +0200
Message-ID<cce24f9d4b6854bb833b42076a74f6be@remailer.privacy.at>
In reply to#14942
Unknown <...@gmail.com> [U]:

U> > ps auxww |grep mcedit|grep -v grep
Useless use of grep.

Try this instead:          ([t] is a single member character set)

  ps auxww | grep mcedi[t]   


(The same trick can be applied to your shell function)

[toc] | [prev] | [next] | [standalone]


#14955

FromWilliam Unruh <unruh@invalid.ca>
Date2015-06-17 03:53 +0000
Message-ID<mlqqvi$1qj$3@dont-email.me>
In reply to#14947
On 2015-06-15, Anonymous Remailer (austria) <mixmaster@remailer.privacy.at> wrote:
>
> Unknown <...@gmail.com> [U]:
>
> U> > ps auxww |grep mcedit|grep -v grep
> Useless use of grep.

No very useful. But you have another possible way to do the same thing.

>
> Try this instead:          ([t] is a single member character set)
>
>   ps auxww | grep mcedi[t]   

OK. a bit of a pain typing those [t] and in my bash alias it is harder
to do.

I want to do psg mcedit, not psg mcedit[t] Those extra [] add up.


>
>
> (The same trick can be applied to your shell function)
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.misc


csiph-web