File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can variables be used as pattern for awk command?

 
anandkumar biyani
Greenhorn
Posts: 9
  • 0
  • 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
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • 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