[SOLVED] How to use 'grep' for files found from 'find' ..
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Great! It found correct file. The last thing left is somehow get rid of 'warning' and other 'irrelevant' stuff. I need to see only file and nothing more ..
Seeing as no one else has mentioned it, please use [code][/code] tags around your code so it is more readable and maintains formatting.
"irrelevant" is a stretch .. it is giving you information that may be necessary, but if you really want to get rid of it you can redirect the stderr from your loop to go to /dev/null if you feel the
information is not warranted.
Folks,
Now everything works as expected. Thanks for the help.
The last thing still missing is the 'path' to the file
I have an output like this:
temp/C/ProgramData/Tecan/EVOware/output/..../file.x
But this does not help me. I need 'absolute' path to the file like
ABC.zip/C/ProgramData...
or
DEF.zip/C/....
How script could be modified to get the whole path?
Thanks again ..
It did not make any difference.
I still get this:
/search.sh DNA0000005631
temp/C/ProgramData/Tecan/EVOware/output/Sample Tracking/.../file.x
temp/C/ProgramData/Tecan/EVOware/output/Sample Tracking/.../file.c
## This script will search for provided PATTERN in 'zipped' files and list files
## For better performance go to the 'lowest' directory
## Usage: ./search.sh <PATTERN> | sort | uniq
Well ... sorry for my typo
Now it produce correct path but it's truncated and does not give me the name of the file I'm interested in ..
I have this:
./search.sh DNA0000005631
./Backup Files 2016-05-26 142101/Backup files 1.zip/C/ProgramData/Teca
While the path is:
temp/C/ProgramData/Tecan/EVOware/output/Sample Tracking/Archive/DVALABB002419_04282016_131616.csv
Having truncated path does not allow me to locate the file
Maybe terminal output is seen through some sort of pager that truncates long lines? Just a thought
Nah, it's the field separator I used in the awk. I was trying to effectively disable it by setting it to a new line, but apparently "-F\n" just sets it to a literal "n", so the first "n" it ran into it split the line. I just switched the gensub to use the entire input "$0" and disabled field splitting, which should take care of it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.