Sample Header Ad - 728x90

read line by line and execute cat with grep

2 votes
2 answers
2835 views
Im building a script to load from a file content and then use to cat and grep in another file. The problem is that is not showing any values while executing the grep. If i do the command manually it will retrieve the data. i already use the while but the issue is the same. the output6.txt is always empty. the echo seems to work, so it seems to be the grep or cat issue. Sample from BlockspamCLIs.txt i have the values: 4412345 441236 2367890 Sample All_events.csv file 1,441236,20220909120909,test 2,441237,20220909120909,test 3,441232,20220909120909,test 4,44136,20220909120909,test 5,2367890,20220909120909,test As an output im expecting to retrieve and store and record inside of the CSV file that contains the number for example: 1,441236,20220909120909,test 5,2367890,20220909120909,test my script: for i in cat BlockspamCLIs.txt do grep $i *_All_events.csv >> output6.txt echo $i done thank you in advance.
Asked by macieira (123 rep)
Sep 28, 2022, 08:27 AM
Last activity: Aug 7, 2024, 10:21 AM