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.
I need to find some data in a large no. of files. The data is in the following format :
VALUE A VALUE B VALUE C VALUE D
10 4 65 1
12 4.5 65.5 2
10.75 5.1 87 3
9.8 4 67 4
All the files have data is the same format (above). I need to write a script that copies those files (to a subdirectory, which also the script should create) that have ANY row satisfying the search criteria that : 10.5<VALUE A<11.5 && 4.5<VALUE B<5.5 && 80<VALUE C<90, and then also displays the VALUE D for those particular rows in the selected file which fulfill the above criteria.
The files are in "bin/models" which has two subdirectories,"model 1"and "model 2", each of which contain 10 data files. The files end in ".track". The new subdirectories are to be named "new_sub", and are to be created both in "model 1" and "model 2".
Thanks a TON in advance; I really need to know this one quick for a project!! Please help!
The END block will be executed, and there is a variable called FILENAME which you can use to print out the filename with a match, or even a command with the cp or mv command to move the file into the subdirectory.
I didn't follow what you want to do with the 4th field. That seems to imply that you may also want a file produced containing all matching lines, in which case, don't use exit, but set a flag, and print out the 4th column. Check this flag in the END block to determine if there were any matches.
I think your idea of simply using the std o/p in a for loop makes better sense. I followed the link, and I think it'll prove helpful.
By the way, what is 'END block' and how do I put my filename in the FILENAME variable?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.