Python Forum
script to filter python files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
script to filter python files
#1
i was doing this in grep a lot so i made this little script and put it at /usr/local/bin/pygrep.


so now i use the script a lot.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Could you elaborate on the benefit(s) of this?
Reply
#3
Also curious... and why not an alias anyway.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#4
(Nov-02-2016, 03:33 PM)micseydel Wrote: Could you elaborate on the benefit(s) of this?

i, personally, scan for files a lot with pipelines to work with very large lists (i currently have around 6000000 files in the /home directories.  filtering specific file types makes for faster content searches and gives me less noise.

for many people, there may be no benefit at all.

(Nov-02-2016, 06:17 PM)Ofnuts Wrote: Also curious... and why not an alias anyway.

it could have been an alias.  but i have many times run into cases where filtering file paths like this is not running under a shell, or initializing the shell to have all my aliases (there would be many if i did this as aliases or shell functions) is not always practical.  i have done many of these as shell scripts and they are under my working plans to convert most shell scripts to python3.  when i write new scripts, now, i try to do them in python3 first, falling back to python2, pike, awk, bash and C (in that order) if there are problems (had one, once, but re-did it in python3 later).  simple aliase-like commands like this are trivial and have never had problems.

i just rewrote it to take symlinks for many languages/extension:


then i did:

ln -fsv grepext /usr/local/bin/pygrep
and some others.  symlinks still take filesystem space and cache memory so there is still no real gain.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Watch files and automatically run a script in Linux Gribouillis 4 4,575 Aug-14-2023, 11:57 AM
Last Post: Gribouillis
  Wireshark-like Display Filter for Python Dictionaries bytebutcher 0 2,333 Feb-20-2022, 11:05 AM
Last Post: bytebutcher
Lightbulb Script broke with Python 3 / improve script for printing aspecteleven 4 4,528 Feb-22-2019, 12:23 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020