Sponsored Content
Full Discussion: Use awk to pick out zip code
Top Forums Shell Programming and Scripting Use awk to pick out zip code Post 302352575 by grossgermany on Saturday 12th of September 2009 02:43:19 AM
Old 09-12-2009
Use awk to pick out zip code

Hi,

Suppose I have a csv file, each line look like this:
ABC Company, 1999, March, caucasian owned, 123 BroadWay NY 92939-2222

How do I create two new columns at the end, one for state, one for zip.

So that the line is
ABC Company, 1999, March, caucasian owned, 123 BroadWay NY 92939-2222,NY,92939-2222


To help you with the code, I've created a list of all possible State Abbreviations.
[AL, AK, AZ, AR, CA, CO, CT, DE, DC, FL, GA, ID, IL, IN, IA, KS, LA, MD, MA, MI, MN, MS, MO, MT, NE, NV, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VA, WA, WV, WI, WY]
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pick up the return code for every iteration and display the result only once in loop.

Hi All, I amlearning UNIX scripting. I have a small query. I would be thankful if any one helps me out. I have a below piece of code which delets the files. If file dosent have the permissions to delete a particular file I have used 2>>operator to track the error code. But my objective is... (1 Reply)
Discussion started by: manas6
1 Replies

2. Shell Programming and Scripting

zip code filter problem using AWK need help

Hello all; I have a large file (csv file) with addresses. I am trying to filter out specific entries based on zip code from a particular column of data. However my awk statement can not account for zipcode that begins with a certain pattern. It finds the pattern anywhere within the zipcode. ... (3 Replies)
Discussion started by: nelsonsierra
3 Replies

3. Shell Programming and Scripting

Manipulating Pick multi dimensional data with awk.

Hi. I am reasonably new to awk, but have done quite a lot of unix scripting in the past. I have resolved the issues below with unix scripting but it runs like a dog. Moved to awk for speed and functionality but running up a big learning curve in a hurry, so hope there is some help here. I... (6 Replies)
Discussion started by: mike.strategis
6 Replies

4. UNIX Desktop Questions & Answers

awk to pick out more than one line

This really is a dummy question but I'm stuck and out of time... I have a large file and out of it I only want to pick out lines starting with either "Pressure" or "N". I still need these lines to be in their original order. example of text Pressure 3 N 2 N 3 bla bla bla bla Pressure 4... (3 Replies)
Discussion started by: jenjen_mt
3 Replies

5. Shell Programming and Scripting

use awk pick value from lines as condition for grep

Hi Folks! I have a file like this 000000006 dist:0.0 FILE ./MintRoute/MultiHopWMEWMA.nc LINE:305:1 NODE_KIND:131 nVARs:4 NUM_NODE:66 TBID:733 TEID:758 000000000 dist:0.0 FILE ./Route/MultiHopLEPSM.nc LINE:266:1 NODE_KIND:131 nVARs:4 NUM_NODE:66 TBID:601 TEID:626 000000001 ... (2 Replies)
Discussion started by: jackoverflow
2 Replies

6. Shell Programming and Scripting

How to pick a group of data using awk/ksh

Hi gurus, I have data coming in as shown below. And in each case, I need to pick the data in the last group as shown below. Data Set 1: DC | 18161621 LA | 15730880 NY | 16143237 DC | 18161621 LA | 17316397 NY | 17915905 DC | 18161621 LA | 17993534 NY | 18161621 DC | 18161621... (11 Replies)
Discussion started by: calredd
11 Replies

7. Shell Programming and Scripting

Pick first "code" only [ grep/awk ]

All I have a requirement to search and pick the data as below. Explained with example. 38999|4812 Highway 52 North|Rockville|55901|0196 67541|2800 Dexter Road|Northville|38999|0196 This is pipe separate data. First column represents dealer id and 4th column represents the zip code where... (4 Replies)
Discussion started by: ak835
4 Replies

8. Shell Programming and Scripting

Code to pick all files from a directory and send it to a command

(4 Replies)
Discussion started by: rossi
4 Replies

9. Shell Programming and Scripting

awk - Pick last value from set of rows

Input data COL_1,COL_2,COL_3,COL_4,COL_5,COL_6,COL_7,COL_8,COL_9,COL_10,COL_11,COL_12,COL_13 C,ABC,ABCD,3,ZZ,WLOA,2015-12-01,2016-12-01,975.73,ZZZ,P,111111.00,Y1 **GROUP1** C,ABC,ABCD,3,ZZ,WLOA,2015-12-01,2016-12-01,975.73,ZZZ,P,222222.00,Y1 **GROUP1**... (2 Replies)
Discussion started by: Ads89
2 Replies
ZIP_ERRORS(3)						     Library Functions Manual						     ZIP_ERRORS(3)

NAME
zip_errors - list of all libzip error codes LIBRARY
libzip (-lzip) SYNOPSIS
#include <zip.h> DESCRIPTION
The following error codes are used by libzip: [ZIP_ER_OK] No error. [ZIP_ER_MULTIDISK] Multi-disk zip archives not supported. [ZIP_ER_RENAME] Renaming temporary file failed. [ZIP_ER_CLOSE] Closing zip archive failed. [ZIP_ER_SEEK] Seek error. [ZIP_ER_READ] Read error. [ZIP_ER_WRITE] Write error. [ZIP_ER_CRC] CRC error. [ZIP_ER_ZIPCLOSED] Containing zip archive was closed. [ZIP_ER_NOENT] No such file. [ZIP_ER_EXISTS] File already exists. [ZIP_ER_OPEN] Can't open file. [ZIP_ER_TMPOPEN] Failure to create temporary file. [ZIP_ER_ZLIB] Zlib error. [ZIP_ER_MEMORY] Malloc failure. [ZIP_ER_CHANGED] Entry has been changed. [ZIP_ER_COMPNOTSUPP] Compression method not supported. [ZIP_ER_EOF] Premature EOF. [ZIP_ER_INVAL] Invalid argument. [ZIP_ER_NOZIP] Not a zip archive. [ZIP_ER_INTERNAL] Internal error. [ZIP_ER_INCONS] Zip archive inconsistent. [ZIP_ER_REMOVE] Can't remove file. [ZIP_ER_DELETED] Entry has been deleted. [ZIP_ER_ENCRNOTSUPP] Encryption method not supported. [ZIP_ER_RDONLY] Read-only archive. [ZIP_ER_NOPASSWD] No password provided. [ZIP_ER_WRONGPASSWD] Wrong password provided. AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at> NiH March 10, 2009 ZIP_ERRORS(3)
All times are GMT -4. The time now is 04:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy