[SOLVED] Script for filtering multiple items from a list
by zetrotrack000 from LinuxQuestions.org on (#4XX57)
Hi
I have a huge list of items with their weights. For example,
Code:item1 24.5
item2 22.3
item3 24.4
etc,Sometimes, I need to filter some of these items according to specified weights. For instance, I want to list all those items whose weight are exactly 20.1, 24.2 and 25.1
I know we can use oneliners like awk, sed, grep to filter these items. But I want to create a simple script, which can filter items according to these specified weights and saves output in another file, and I can run this script as:
Code:[pc ~]# weight_filter input_file > output_fileWhen I try to create such script and put sed or awk, the script does not work and shows no output. Kindly guide me to create such a script.
Thanks


I have a huge list of items with their weights. For example,
Code:item1 24.5
item2 22.3
item3 24.4
etc,Sometimes, I need to filter some of these items according to specified weights. For instance, I want to list all those items whose weight are exactly 20.1, 24.2 and 25.1
I know we can use oneliners like awk, sed, grep to filter these items. But I want to create a simple script, which can filter items according to these specified weights and saves output in another file, and I can run this script as:
Code:[pc ~]# weight_filter input_file > output_fileWhen I try to create such script and put sed or awk, the script does not work and shows no output. Kindly guide me to create such a script.
Thanks