Search Results

Search: Posts Made By: dbgork
19,137
Posted By ctsgnb
you also can have #cat toto orange tomato ...
you also can have
#cat toto
orange
tomato
# grep -f toto veg
orange
tomato
tomato
19,137
Posted By Chubler_XL
To do a direct convert of your pseudo code, using...
To do a direct convert of your pseudo code, using bash arrays:

#!/bin/bash
table=(apple orange tomato)
for((i=0; i < ${#table[@]}; i++))
do
grep ${table[$i]} h.txt
done
19,137
Posted By ctsgnb
[ctsgnb@shell ~]$ cat veg whatever orange ...
[ctsgnb@shell ~]$ cat veg
whatever
orange
tomato
whatever
tomato
whatever
[ctsgnb@shell ~]$ var='tomato|orange'
[ctsgnb@shell ~]$ grep -E "$var" veg
orange
tomato
tomato
[ctsgnb@shell ~]$
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 04:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy