0

I have a data which looks like this

cat 1.txt 

abc def ghi
jkl lmn opq
rst uvw xyz

i want to use its contents in another command :

foreach c (`cat 1.txt | awk '{print $1}'`)
cat $c/$1 | sed "s,patter1,pattern2,g" > ! $c/$2
end

where $c=abc , $1 =def , $2 = ghi in first case, then $c=jkl , $1 =lmn , $2 = opq in second case and so on till end of 1.txt

Can someone suggest, how can i do it?

I have tried below :

foreach c (`awk '{print $1}' 1.txt`)
foreach d (`awk '{print $2}' 1.txt`)
foreach e ( `awk '{print $3}' 1.txt` )
echo $c $d $e 
end
end
end
Priyanka
  • 3
  • 5
  • 1
    What you want to do at the end? – Romeo Ninov Feb 28 '20 at 07:12
  • I want to use this table to set variables and use those variables in below command: foreach c (`cat 1.txt | awk '{print $1}'`) cat $c/$1 | sed "s,patter1,pattern2,g" > ! $c/$2 end – Priyanka Feb 28 '20 at 07:34
  • No, you want probably something else, explain it with own words – Romeo Ninov Feb 28 '20 at 07:39
  • i wan to set $c=abc , $1 =def , $2 = ghi in first case, then use $c $1 $2 in another command since these are to accessed from a file 1.txt, whose content i have given in question – Priyanka Feb 28 '20 at 07:49

0 Answers0