The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running UNIX commands remotely in Windows box from Unix box – avoid entering password D.kalpana UNIX for Dummies Questions & Answers 1 04-20-2007 02:24 AM
SQL Commands in Unix sish78 Shell Programming and Scripting 6 05-25-2006 03:30 PM
Need help on Unix commands. adngu3 High Level Programming 1 03-09-2005 06:21 AM
Maingrame to UNIX sending UNIX commands skammer UNIX for Dummies Questions & Answers 2 06-27-2002 09:19 AM
Unix Commands smdakram UNIX for Dummies Questions & Answers 2 01-13-2002 04:12 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-25-2006
Registered User
 

Join Date: Jul 2006
Posts: 22
How to use unix commands in awk

Hi All,
I try to use the unix commands inside awk and couldnt succeed .
Please help me how to achieve it.







Regards,
Sukumar.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-25-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,994
where exactly are you stuck?
Reply With Quote
  #3 (permalink)  
Old 12-25-2006
Registered User
 

Join Date: Jul 2006
Posts: 22
Inside the awk.

echo $h|awk '{
"if [ "'$h'" -eq "hi" ]
then
echo "Success"
else
echo "Failure"
fi"
}'

I dont know where iam right or not.please help me
Reply With Quote
  #4 (permalink)  
Old 12-25-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,994
don't understand what you're trying to achieve, but.....
look into 'system' call on awk's man page.

or
Code:
cmd="date"
cmd | getline myDate
close(cmd)
printf("NOW -> [%s]\n", myDate)
Reply With Quote
  #5 (permalink)  
Old 12-25-2006
Registered User
 

Join Date: Sep 2006
Posts: 1,423
judging from what you want to do in your awk portion, you could have just
done simple comparison in shell, no need for awk.
Reply With Quote
  #6 (permalink)  
Old 12-25-2006
Registered User
 

Join Date: Jul 2006
Posts: 22
This is not just a comparison

Hi ghostdog,

This is not just a comparison,I am trying to achieve deletion and moving of files after text processing.

The below example is a simple try for unix commands inside awk.






Regards,
Sukumar.
Reply With Quote
  #7 (permalink)  
Old 12-25-2006
tayyabq8's Avatar
Registered User
 

Join Date: Nov 2004
Location: Kuwait
Posts: 510
Can you post here your exact requirement in detail i.e. post here what you want to achieve not how you want to achieve. Thanks. Regards, Tayyab
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0