Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can variables be used as pattern for awk command?  RSS feed

 
anandkumar biyani
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I wanted to know if we can use the variable as a pattern for awk command as shown below:

$c = "Dec Tue";
$log = `awk '/\$c/' in.txt`;
print $log;

I have to search for a pattern in $c occuring in file in.txt.

Thanks in advance.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12441
42
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!