Article 6CR4W Setting 2 files for grep search in 1 unique variable

Setting 2 files for grep search in 1 unique variable

by
pedropt
from LinuxQuestions.org on (#6CR4W)
Hi everyone , i am stuck here with a doubt , i want to set 2 files for grep search but i want to use them as an unique variable of both .

What i need :

Quote:
log1="/var/log/nginx/access.log"
log2="/var/log/nginx/access.log.1"
weblog="$log1" "$log2"

some command in grep next :
grep "something" "$weblog"
I get an error of file missing , but file is there .
I know that i can use them like this and it works :

Quote:
grep "something" "$log1" "$log2"
however if i set those 2 logs in 1 single variable i get an error .

I was thinking in setting just 1 log variable as :

log="/var/log/nginx/access.log*"

but this will include also the gzip files inside nginx logs directory , witch are access.log.2.gz , etc... , and i do not want that .

Any ideas how can i manage to set those 2 logs in one unique variable ?

Thank you
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments