The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Conditional FTP Dastard Shell Programming and Scripting 2 06-21-2008 07:38 AM
conditional email ricky007 Shell Programming and Scripting 3 03-06-2008 01:38 AM
conditional statement lalelle Shell Programming and Scripting 8 08-21-2007 08:57 AM
conditional split braindrain Shell Programming and Scripting 5 03-11-2006 03:54 AM
Conditional Statements cstovall Shell Programming and Scripting 1 05-15-2005 05:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-28-2008
Rafael.Buria Rafael.Buria is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 16
AWK - conditional cause

Hello guys,

I want to make a conditional cause in the following file using awk:
awk '{ if ($2 != 0) print $1, $2, $3}' test.csv > test2.csv

FILE EXAMPLE = test.csv

string,number,date
abc,0,20050101
def,1,20060101
ghi,2,20040101
jkl,12,20090101
mno,123,20020101
pqr,1234,20020101
stu,0,20000101

However i always get in test2.csv the same content of test.csv. Does anyone know what is the problem with my statment?

Best Regards
  #2 (permalink)  
Old 01-28-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
Code:
awk -F, 'BEGIN {OSF=","} { if ($2 != 0) print $1, $2, $3}' test.csv > test2.csv
  #3 (permalink)  
Old 01-28-2008
Rafael.Buria Rafael.Buria is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 16
thanks Jim...
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0