awk - how to map and compare filename in shell script -


i'm using below code map filename

function insert_data()  {              file in `ls -lrt added_to_* | awk '{print $9}'`                 echo "running file: $file"             map_file="mapping_rule_categories.txt"           path=`ls -lrt added_to_* | awk '{print $9}'`                     output=`cat $map_file | awk -f "|" -vnick="$path" '{if("$8"=="$nick") print $9}'`     echo $output     done } insert_data; 

where mapping_rule_categories.txt having mapping

removed_from_drop.rules|disabled_in_drop.rules | disabled_and_modified_in_drop.rules | modified_inactive_in_drop.rules|modified_active_in_drop.rules | enabled_and_modified_in_drop.rules | enabled_in_drop.rules | added_to_drop.rules | drop.rules 

and files in directory like:

added_to_botcc.rules added_to_compromised.rules added_to_drop.rules 

i need output should print filename after using map file :

botcc.rules compromised.rules drop.rules 

i don't understand of question (tip: it) input expected output:

adding file space in name test dir:

$ touch added_to_this\ test  # advanced test space in filename $ ls                         # files , added_to_botcc.rules        added_to_drop.rules added_to_compromised.rules  added_to_this test 

processing files:

$ in added_to_* ; echo ${i#added_to_} ; done botcc.rules compromised.rules drop.rules test 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -