Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

if statement in awk

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-04-2009   -   Original Discussion by UNovIX
UNovIX UNovIX is offline
Registered User
 
Join Date: Jul 2009
Last Activity: 11 August 2009, 3:31 PM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
if statement in awk

Hi Friends

How do I do two things from one if statement inside awk? I want to run a script and create a new file from the same condition.



awk '{ if ($2 == ""){print " "|"cd /local/test; ./script.ksh"}{cat > ran_true.txt}}' $IN_FILE

Bolded are the two things I want to be done.

Thanks
Sponsored Links
    #2  
Old Unix and Linux 08-04-2009   -   Original Discussion by UNovIX
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 19 November 2017, 7:33 PM EST
Location: NM
Posts: 11,239
Thanks: 571
Thanked 1,116 Times in 1,030 Posts

Code:
awk '{ if ($2 == ""){print " "|"cd /local/test; ./script.ksh"; cat > ran_true.txt}}' $IN_FILE
# or
awk '{ if ($2 == ""){print " "|"cd /local/test; ./script.ksh"
                           cat > ran_true.txt}}' $IN_FILE

solaris: try nawk, not awk.
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
if statement ROOZ Shell Programming and Scripting 7 11-05-2008 10:02 PM
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 10:26 PM
IF Statement koti_rama Shell Programming and Scripting 3 04-29-2008 05:48 AM
If statement - How to write a null statement april Shell Programming and Scripting 3 04-16-2008 02:14 PM
If statement ROOZ UNIX for Dummies Questions & Answers 3 03-09-2008 01:57 PM



All times are GMT -4. The time now is 10:18 PM.