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
need to extract field of characters in a line jansat Shell Programming and Scripting 3 05-22-2008 06:44 AM
How to grab the value of field before the line reached ahjiefreak Shell Programming and Scripting 3 03-28-2008 02:59 AM
removing last field of the line adddy UNIX for Dummies Questions & Answers 4 12-11-2006 08:35 PM
Replacing the last field of a line. Darek Shell Programming and Scripting 3 08-19-2005 08:45 AM
Append a field to the end of each line of a file based on searching another file. ultimate Shell Programming and Scripting 2 03-29-2005 07:21 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-06-2005
Registered User
 

Join Date: Jun 2005
Location: New York City
Posts: 95
AWK line by line instead of field by field?

I've been using a lot of awk lately for csv files.
But I've been using awk for csv files that contain 32 fields per line.

For the first time, I've been given a csv file that contains one field per line (13 fields in each csv file).

I need to check that a specific field, or line contains a string.
There are no commas or delimiters at the end of each line.

Here's how I would calculate it if all fields were in one line.
Code:
trade_count=`awk -F, '$7 ~ /:22A:NEWT/ { trade_count++ } END { print trade_count }' myCSV.csv`
How would I convert that to a csv file that has one field per line?

I found this in another post, how do I apply it to what I want to accomplish?
awk '{ if(NR == 7) print}' <filename>
Reply With Quote
Forum Sponsor
  #2  
Old 07-06-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Change $7 to $0 -- $0 is the whole line
Reply With Quote
  #3  
Old 07-06-2005
Registered User
 

Join Date: Jun 2005
Location: New York City
Posts: 95
Oh my goodness.

I feel so dumb I'm laughing at myself right now.
That worked so well.......

Thanks.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:00 AM.


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

Content Relevant URLs by vBSEO 3.2.0