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
SCHEDCTL(8)						    BSD System Manager's Manual 					       SCHEDCTL(8)

NAME
schedctl -- control scheduling of processes and threads SYNOPSIS
schedctl [-A cpus] [-C class] [-P pri] [-t lid] -p pid | command DESCRIPTION
The schedctl command can be used to control the scheduling of processes and threads. It also returns information about the current schedul- ing parameters of the process or thread. Only the super-user may change the scheduling parameters. schedctl can also be used to start a new command using the specified parameters. Available options: -A cpus Set of the processors on which process or thread should run, that is, affinity. Processors are defined as numbers (starting from zero) and separated by commas. A value of -1 is used to unset the affinity. -C class Scheduling class (policy), one of: SCHED_OTHER Time-sharing (TS) scheduling policy. The default policy in NetBSD. SCHED_FIFO First in, first out (FIFO) scheduling policy. SCHED_RR Round-robin scheduling policy. -P pri Priority for the process or thread. Value should be in the range from SCHED_PRI_MIN (0) to SCHED_PRI_MAX (63). Setting of prior- ity for the process or thread running at SCHED_OTHER policy is not allowed. -p pid The target process which will be affected. If the process has more than one thread, all of them will be affected. If -p is not given, a command to execute must be given on the command line. -t lid Thread in the specified process. If specified, only this thread in the process will be affected. May only be specified if -p is also given. EXAMPLES
Show scheduling information about the process whose ID is ``123'': # schedctl -p 123 Set the affinity to CPU 0 and CPU 1, policy to SCHED_RR, and priority to 63 for thread whose ID is ``1'' in process whose ID is ``123'': # schedctl -p 123 -t 1 -A 0,1 -C SCHED_RR -P 63 Run the top(1) command with real-time priority: # schedctl -C SCHED_FIFO top SEE ALSO
nice(1), getpriority(2), setpriority(2), psrset(8), renice(8) HISTORY
The schedctl command first appeared in NetBSD 5.0. BSD
March 21, 2011 BSD
All times are GMT -4. The time now is 12:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy