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


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

list but not dirs?

Started byUnknown <dog@gmail.com>
First post2015-01-27 08:10 +0000
Last post2015-02-03 18:08 +0000
Articles 9 — 6 participants

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


Contents

  list but not dirs? Unknown <dog@gmail.com> - 2015-01-27 08:10 +0000
    Re: list but not dirs? Tim Watts <tw_usenet@dionic.net> - 2015-01-27 09:27 +0000
    Re: list but not dirs? Chris Davies <chris-usenet@roaima.co.uk> - 2015-01-27 11:56 +0000
      Re: list but not dirs? Unknown <dog@gmail.com> - 2015-02-03 07:43 +0000
    Re: list but not dirs? Joe Beanfish <joebeanfish@nospam.duh> - 2015-01-28 14:51 +0000
      Re: list but not dirs? Unknown <dog@gmail.com> - 2015-02-03 11:53 +0000
        Re: list but not dirs? Joe Beanfish <joebeanfish@nospam.duh> - 2015-02-03 14:17 +0000
          Re: list but not dirs? Moe Trin <ibuprofin@painkiller.example.tld.invalid> - 2015-02-03 21:56 +0000
        Re: list but not dirs? Rich <rich@example.invalid> - 2015-02-03 18:08 +0000

#13494 — list but not dirs?

FromUnknown <dog@gmail.com>
Date2015-01-27 08:10 +0000
Subjectlist but not dirs?
Message-ID<pan.2015.01.27.08.20.10@gmail.com>
This must be one of the most fundamental commands !!

I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
having average 3 eTerminals open.

#!/bin/bash

echo "List File:Arg1 inAll active Dirs:per:lsof"
for Dirs in `lsof | grep cwd | awk '{print $9}' | sort| uniq`; do 
  echo "In Dir: " $Dirs;
# if [ -f "$Dirs/*$1" ]; then ?! Can't test BEFORE listing !!
  ls   $Dirs/*$1; 
  echo "<><><><><>"; 
done
-----
But don't list any <sub-dir>pdf

[toc] | [next] | [standalone]


#13497

FromTim Watts <tw_usenet@dionic.net>
Date2015-01-27 09:27 +0000
Message-ID<192kpb-u68.ln1@squidward.dionic.net>
In reply to#13494
On 27/01/15 08:10, Unknown wrote:
> This must be one of the most fundamental commands !!
>
> I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
> having average 3 eTerminals open.

?

That makes no sense to me.

Can you restate the problem?

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


#13498

FromChris Davies <chris-usenet@roaima.co.uk>
Date2015-01-27 11:56 +0000
Message-ID<tvakpbxlcj.ln2@news.roaima.co.uk>
In reply to#13494
Unknown <dog@gmail.com> wrote:
> I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
> having average 3 eTerminals open.

> #!/bin/bash
> echo "List File:Arg1 inAll active Dirs:per:lsof"

Your code appears to try to list all files matching a specified suffix
in the current directory of each process you have running. Is that what
you want?

#!/bin/bash
#
SUFFIX="$1"
echo "Listing files of type $SUFFIX in all active directories"

for DIR in $( lsof -u "$USER" | awk '$4=="cwd" && $5=="DIR" {print $9}' | sort -u )
do
    echo "In directory: $DIR"
    for FILE in "$DIR"/*."$SUFFIX"
    do
	test -f "$FILE" && echo "  $FILE"
    done
    echo
done
exit 0

Chris

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


#13560

FromUnknown <dog@gmail.com>
Date2015-02-03 07:43 +0000
Message-ID<pan.2015.02.03.07.54.12@gmail.com>
In reply to#13498
On Tue, 27 Jan 2015 11:56:13 +0000, Chris Davies wrote:

> Unknown <dog@gmail.com> wrote:
>> I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
>> having average 3 eTerminals open.
> 
>> #!/bin/bash
>> echo "List File:Arg1 inAll active Dirs:per:lsof"
> 
> Your code appears to try to list all files matching a specified suffix
> in the current directory of each process you have running. Is that what
> you want?
> 
> #!/bin/bash
> #
> SUFFIX="$1"
> echo "Listing files of type $SUFFIX in all active directories"
> 
> for DIR in $( lsof -u "$USER" | awk '$4=="cwd" && $5=="DIR" {print $9}'
> | sort -u ) do
>     echo "In directory: $DIR"
>     for FILE in "$DIR"/*."$SUFFIX"
>     do
> 	test -f "$FILE" && echo "  $FILE"
>     done
>     echo
> done
> exit 0
> 
> Chris

!! Fantastic !!
Imagine how this helps you find recently accessed files in your 99
open eterminals.

I've patched it to be more general purpose:....
  for FILE in "$DIR"/*"$PartFlID"*

Thanks a lot.

The next big problem is to associate WorkSpaceNumber with pid/eTerminal.
Old-kde3 showed each-pid grouped to its WS, via `pstree -p`
Since then, `pstree -p` shows all pid, as descendents of ONE <startx>,
with blackbox, my prefered  windowManager.

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


#13501

FromJoe Beanfish <joebeanfish@nospam.duh>
Date2015-01-28 14:51 +0000
Message-ID<maat1i$ipg$1@dont-email.me>
In reply to#13494
On Tue, 27 Jan 2015 08:10:30 +0000, Unknown wrote:

> This must be one of the most fundamental commands !!
> 
> I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
> having average 3 eTerminals open.
> 
> #!/bin/bash
> 
> echo "List File:Arg1 inAll active Dirs:per:lsof"
> for Dirs in `lsof | grep cwd | awk '{print $9}' | sort| uniq`; do
>   echo "In Dir: " $Dirs;
> # if [ -f "$Dirs/*$1" ]; then ?! Can't test BEFORE listing !!
>   ls   $Dirs/*$1;
>   echo "<><><><><>";
> done -----
> But don't list any <sub-dir>pdf

"Works for me" as they say. Presumably you're running it as
   scriptname pdf

By <sub-dir> do you mean $Dirs or sub directories of $Dirs? To go
deep use find instead of ls:
   find $Dirs -name "*$1" -print;

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


#13566

FromUnknown <dog@gmail.com>
Date2015-02-03 11:53 +0000
Message-ID<pan.2015.02.03.12.03.51@gmail.com>
In reply to#13501
On Wed, 28 Jan 2015 14:51:30 +0000, Joe Beanfish wrote:

> On Tue, 27 Jan 2015 08:10:30 +0000, Unknown wrote:
> 
>> This must be one of the most fundamental commands !!
>> 
>> I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
>> having average 3 eTerminals open.
>> 
>> #!/bin/bash
>> 
>> echo "List File:Arg1 inAll active Dirs:per:lsof" for Dirs in `lsof |
>> grep cwd | awk '{print $9}' | sort| uniq`; do
>>   echo "In Dir: " $Dirs;
>> # if [ -f "$Dirs/*$1" ]; then ?! Can't test BEFORE listing !!
>>   ls   $Dirs/*$1;
>>   echo "<><><><><>";
>> done -----
>> But don't list any <sub-dir>pdf
> 
> "Works for me" as they say. Presumably you're running it as
>    scriptname pdf
> 
> By <sub-dir> do you mean $Dirs or sub directories of $Dirs?

I probably meant *$1* must be a file [not directory-name].

> To go deep
> use find instead of ls:
>    find $Dirs -name "*$1" -print;

OK thanks, I'll need that too - later. Perhaps an alternative version.
How do people keep their structured-menu of such utilities?
Trying to remember is anti-computer-usage.

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


#13569

FromJoe Beanfish <joebeanfish@nospam.duh>
Date2015-02-03 14:17 +0000
Message-ID<maqla7$r6n$1@dont-email.me>
In reply to#13566
On Tue, 03 Feb 2015 11:53:04 +0000, Unknown wrote:

> On Wed, 28 Jan 2015 14:51:30 +0000, Joe Beanfish wrote:
> 
>> On Tue, 27 Jan 2015 08:10:30 +0000, Unknown wrote:
>> 
>>> This must be one of the most fundamental commands !!
>>> 
>>> I want to see all *.pdf [or any *] in all of my 30 workSpace, with
>>> each having average 3 eTerminals open.
>>> 
>>> #!/bin/bash
>>> 
>>> echo "List File:Arg1 inAll active Dirs:per:lsof" for Dirs in `lsof |
>>> grep cwd | awk '{print $9}' | sort| uniq`; do
>>>   echo "In Dir: " $Dirs;
>>> # if [ -f "$Dirs/*$1" ]; then ?! Can't test BEFORE listing !!
>>>   ls   $Dirs/*$1;
>>>   echo "<><><><><>";
>>> done -----
>>> But don't list any <sub-dir>pdf
>> 
>> "Works for me" as they say. Presumably you're running it as
>>    scriptname pdf
>> 
>> By <sub-dir> do you mean $Dirs or sub directories of $Dirs?
> 
> I probably meant *$1* must be a file [not directory-name].
> 
>> To go deep use find instead of ls:
>>    find $Dirs -name "*$1" -print;
> 
> OK thanks, I'll need that too - later. Perhaps an alternative version.
> How do people keep their structured-menu of such utilities?
> Trying to remember is anti-computer-usage.

Menu? We don't need no stinkin menu.

<tongueincheek>
*nix is made up of 2-4 letter commands which must be memorized. Arranging
things into cute menus and such starts to sound like the art of the
ballet-dancers which you have previously contended should be shot.
</tongueincheek>

Actually shell history and tab expansion go a long way.

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


#13592

FromMoe Trin <ibuprofin@painkiller.example.tld.invalid>
Date2015-02-03 21:56 +0000
Message-ID<slrnmd2h17.nl4.ibuprofin@planck.phx.az.us>
In reply to#13569
On Tue, 3 Feb 2015, in the Usenet newsgroup comp.os.linux.misc, in
article <maqla7$r6n$1@dont-email.me>, Joe Beanfish wrote:

><tongueincheek>
>*nix is made up of 2-4 letter commands which must be memorized.
>Arranging things into cute menus and such starts to sound like the
>art of the ballet-dancers which you have previously contended should
>be shot.
></tongueincheek>

SNARFed!!!         I had a UNIX instructor back in the mid-1980s who
would demand to be on the firing squad (if not allowed to command it).

        Old guy

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


#13576

FromRich <rich@example.invalid>
Date2015-02-03 18:08 +0000
Message-ID<mar2r4$neh$2@dont-email.me>
In reply to#13566
Unknown <dog@gmail.com> wrote:
> On Wed, 28 Jan 2015 14:51:30 +0000, Joe Beanfish wrote:

> > To go deep
> > use find instead of ls:
> >    find $Dirs -name "*$1" -print;

> OK thanks, I'll need that too - later. Perhaps an alternative
> version. How do people keep their structured-menu of such utilities?
> Trying to remember is anti-computer-usage.

Surprisingly, some of us actually _remember_ these things.

So we don't need "structured menus".

[toc] | [prev] | [standalone]


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


csiph-web