Home Man
Search
Today's Posts
Register

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

if statement in awk

Tags
beginners

 

 
Thread Tools Search this Thread
# 1  
Old 08-04-2009
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
# 2  
Old 08-04-2009
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.
 

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Convert Update statement into Insert statement in UNIX using awk, sed.... dev123 Shell Programming and Scripting 0 03-22-2016 03:37 AM
awk if then else statement cmccabe Shell Programming and Scripting 2 04-03-2015 01:18 PM
Help with cut statement nick1982 UNIX for Dummies Questions & Answers 8 05-24-2011 09:29 AM
Help Regarding AWk and IF THEN ELSE Statement Shell_Learner Shell Programming and Scripting 2 03-23-2011 04:01 AM
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 09:26 PM
Help On If Statement!! Pablo_beezo Shell Programming and Scripting 2 07-10-2008 06:09 AM
ls in if statement koti_rama Shell Programming and Scripting 2 05-02-2008 04:36 AM
IF Statement koti_rama Shell Programming and Scripting 3 04-29-2008 04:48 AM
Help with if..then..else statement sasaliasim Shell Programming and Scripting 1 04-24-2008 01:46 PM
If statement - How to write a null statement april Shell Programming and Scripting 3 04-16-2008 01:14 PM


All times are GMT -4. The time now is 05:32 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password