1

I need a simple working example that makes me understand

1, awk command in shell script. 2, awk withing awk command in shell script.

3
  • 1
    Without some idea of what it is you're trying to achieve, or what your current skill / knowledge level is, anything trying to 'make you understand' is going to be at best, a shot in the dark... Commented Apr 19, 2011 at 11:34
  • Is this homework? If so, what have you tried so far and why has it not worked out? If not, what are you actually trying to accomplish. Be specific. Commented Apr 19, 2011 at 11:37
  • Get an awk tutorial and go through it. Try these things out and get back to the forum. Commented Apr 19, 2011 at 11:42

1 Answer 1

2

I'm not really sure what the point is, but here's awk calling awk from within a shell script...

#!/bin/sh

cmd='BEGIN {print \"foo\"}'
echo foo |
awk "{ system( \"awk '$cmd'\" )}"
Sign up to request clarification or add additional context in comments.

2 Comments

Hi William, I'm facing problem when compiling this program - stackoverflow.com/questions/5716325/problem-in-using-awk . kindly suggest your opinion
@Logeshwari The program there is not valid. You do not have balanced backquotes. Also, are you trying to use the value of var1 within the program that assigns to var1? I think perhaps there are some lines missing from that snippet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.