I have the following command:
grep -owf champs.txt t.txt
and I want to cut the result of this command from the file t.txt
to another file.
I know that it can be achieved by a nested command but I do not know how to do it.
Note that in the file t.txt
, I have:
select * from student
insert name age from professors
delete from departement where DPTNUM= 20
and in the file champs.txt
I have:
select
insert
into
values
delete
drop
from
create
table
where
set
varchar
number
so the desired result for the first line is:
* student
grep -owf champs.txt t.txt | <command2>
– rahul Apr 14 '15 at 09:28champs.txt
andt.txt
) and your desired output. Also make sure you tell us how your fields are defined. Tabs? Spaces? Commas? Something else? – terdon Apr 14 '15 at 09:28grep -owf champs.txt t.txt > newfile.txt
– jcbermu Apr 14 '15 at 09:30grep
command is a verification of some fields – Aomine Daiki Apr 14 '15 at 09:33t.txt
. – terdon Apr 14 '15 at 09:37