Results 1 to 7 of 7
i tried this one:
BEGIN { print " Hello " }
{
find -name taufiq.txt
}
END { print "Finished " }
is there anything wrong with the code or ...
- 10-19-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 34
can AWK accept Shell cript?
i tried this one:
BEGIN { print " Hello " }
{
find -name taufiq.txt
}
END { print "Finished " }
is there anything wrong with the code or the AWK does not accept Shell command in its script. the error produce is:
awk: MyName.awk:4: find -name taufiq.txt
awk: MyName.awk:4:..............................^ syntax error
- 10-19-2007 #2Just Joined!
- Join Date
- Oct 2007
- Posts
- 37
I don't recognize this. What are you trying to do exactly?
- 10-19-2007 #3Just Joined!
- Join Date
- Jul 2007
- Posts
- 34
i just want to know, does AWK accept SHELL command if we embed the SHELL command in AWK script. Will AWK execute?
because what i want to try latter is create 20 user account using the "adduser" where the user name will be from a text document containing the name of the user account.
- 10-19-2007 #4Linux User
- Join Date
- Aug 2006
- Posts
- 458
- 10-19-2007 #5Just Joined!
- Join Date
- Oct 2007
- Posts
- 37
You could also do it a simpler way by just running:
for user in `cat textfile.txt`; do adduser $user; done
or if needed...
for user in `cat textfile.txt | awk '{print $1}'`; do adduser $user; done
Of course replace textfile.txt with your file and the $1 with the column you need.
- 10-21-2007 #6Just Joined!
- Join Date
- Jul 2007
- Posts
- 34
- 10-21-2007 #7Just Joined!
- Join Date
- Oct 2007
- Posts
- 37
It jst grabs the first column delimited by space, so if you had "john ", it would only grab "john".
Probably not needed, but useful for more than one column.
$1 - column 1
$2 - column 2
and so on.


Reply With Quote
