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 and shell scripting languages 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 10:44 AM
How to grab the value of field before the line reached ahjiefreak Shell Programming and Scripting 3 03-28-2008 05:59 AM
removing last field of the line adddy UNIX for Dummies Questions & Answers 4 12-11-2006 11:35 PM
Replacing the last field of a line. Darek Shell Programming and Scripting 3 08-19-2005 12:45 PM
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 11:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-06-2005
yongho yongho is offline
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>
  #2 (permalink)  
Old 07-06-2005
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,807
Change $7 to $0 -- $0 is the whole line
  #3 (permalink)  
Old 07-06-2005
yongho yongho is offline
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.
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 12:15 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