09-12-2009
Hi Gross... as Our friend franklin has mentioned the code will work perfectly fine...
just adding to it...handled few other conditions too...
sed 's/,/| /g' file | awk '{print $0","$(NF-1)","$NF}' | sed 's/|/,/g'
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
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
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
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
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
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
(4 Replies)
Discussion started by: rossi
4 Replies
9. Shell Programming and Scripting
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