Skip to main content
Became Hot Network Question
edited tags
Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
added 514 characters in body
Source Link
macieira
  • 123
  • 1
  • 6

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.

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.

for i in `cat BlockspamCLIs.txt`
do
   grep $i *_All_events.csv >> output6.txt
   
   echo $i
done

thank you in advance.

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.

Source Link
macieira
  • 123
  • 1
  • 6

read line by line and execute cat with grep

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.

for i in `cat BlockspamCLIs.txt`
do
   grep $i *_All_events.csv >> output6.txt
   
   echo $i
done

thank you in advance.