![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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`
I found this in another post, how do I apply it to what I want to accomplish? awk '{ if(NR == 7) print}' <filename> |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Change $7 to $0 -- $0 is the whole line
|
|
#3
|
|||
|
|||
|
I feel so dumb I'm laughing at myself right now. That worked so well....... Thanks. |
|||
| Google The UNIX and Linux Forums |