Sponsored Content
Top Forums Shell Programming and Scripting awk to delete fields from flat file Post 302870911 by Aditya_001 on Tuesday 5th of November 2013 07:42:26 AM
Old 11-05-2013
Hi Franklin, the above command is not removing the 16th feild which starts with 354 line in a file.

I have executed the above command on my unix box and this is how it shows,

Code:
 
XXXXX:XXXXXXXX [XXXXXXXXXXXX] $ awk -F"|" '/^354/{NF=NF-2;NF++}1' OFS="|" D171_test_file
ZHV|3011|D0171001|L|LPN|Z|PAN|20131104000148||||OPER|
748|49790|
354|902|20131029|1|2|3|4|5|6|7|8|9|10|11|12||
352|5759991|SP29|1200031516735|20131101|
354|||||FLAT 2 AT||2||GARENDON ROAD|||MORDEN|SURREY|SM4 6LN|ADI0001|
748|49792|
352|5760019|SP27|1200021998833|20131101|
XXXXX:XXXXXXXX [XXXXXXXXXXXX] $
 
 
It should have removed the 16th feild from the file where line starts with 354
 
354|902|20131029|1|2|3|4|5|6|7|8|9|10|11|12|

354|||||FLAT 2 AT||2||GARENDON ROAD|||MORDEN|SURREY|SM4 6LN|

Thanks very much,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk to convert a flat file to CSV file

Hi , I have a file with contents as below: Contract Cancellation Report UARCNCL LOS CODE DATE REAS TYPE AMOUNT AMOUNT LETTER BY ========= ======= ==== ==== ==== ========= ==== ==== 8174739 7641509 1S NONE CRCD 30-JUN-2008 NPAR N .00 .00 CCAN 8678696 8091709 1S NONE DDEB 30-JUN-2008... (14 Replies)
Discussion started by: rkumudha
14 Replies

2. Shell Programming and Scripting

Search flat file and return 3 fields

I need to be able to search a flat file (comma-separated values) for a specific value and then return the following 2 fields into variables. Here's a sample flat file: SN,Account,IPaddress W120394YF,adam,10.0.20.2 W394830PR,betty,10.0.20.3 W847582TD,charlie,10.0.20.4... (7 Replies)
Discussion started by: da2357
7 Replies

3. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

4. Shell Programming and Scripting

awk to compare flat files and print output to another file

Hello, I am strugling from quite a some time to compare flat files with over 1 million records could anyone please help me. I want to compare two pipe delimited flat files, file1 with file2 and output the unmatched rows from file2 in file3 Sample File1: ... (9 Replies)
Discussion started by: suhaeb
9 Replies

5. Shell Programming and Scripting

use awk to ssh from variable in flat file

flat file looks like ooss-pfgg-1234,vol_name_1, mail-list decoded = hostname,volum_name,mail_list each line has diff info am trying to ssh into each fist field, check vol usage for second field, and if greater than 90% send mail to mail-list got the second and third part working, ... (1 Reply)
Discussion started by: riegersteve
1 Replies

6. Shell Programming and Scripting

SED | Awk flat file one liner

sed awk one liner (2 Replies)
Discussion started by: jap2614
2 Replies

7. UNIX for Dummies Questions & Answers

using sed delete a line from csv file based on specific data in two separate fields

Hello, :wall: I have a 12 column csv file. I wish to delete the entire line if column 7 = hello and column 12 = goodbye. I have tried everything that I can find in all of my ref books. I know this does not work /^*,*,*,*,*,*,"hello",*,*,*,*,"goodbye"/d Any ideas? Thanks Please... (2 Replies)
Discussion started by: Chris Eagleson
2 Replies

8. Shell Programming and Scripting

Delete last 2 fields from every record in a file

Sample file record : "20130617003","2013-06-18T07:00:03","OUTWARD","01001011","TEST PLC","","HFX834346364364","20130617","10","DUM87534758","","1.28","826","020201","65879278","","","","","","010101","56789","DUMMY... (3 Replies)
Discussion started by: bigbuk
3 Replies

9. Shell Programming and Scripting

awk to place value at 24 field in a flat file issue

I am trying to add 0393 value at 24th feild using the below command, but its adding at all the lines including header and trailer Input file: ZHV|2657|D0217001|T|TXU|Z|PAN|20131112000552||||OPER| 754|52479| 492|489|SP40|1014570286334|20131111|20131201|14355334|CHAMELON... (1 Reply)
Discussion started by: Aditya_001
1 Replies

10. Shell Programming and Scripting

awk Flat File Conversion Script

In awk how would I flatten input.txt to output.txt? Input: givenname: Darth sn: Vadar mail: d.vadar@deathstar.com uid: dv12345 orclguid: 1234567890 givenname: Carlito sn: Brigante mail: c.brigante@paradise.com uid: cb12345 orclguid: 2134567890 Output: ... (3 Replies)
Discussion started by: u20sr
3 Replies
DateTime::Locale::ml(3) 				User Contributed Perl Documentation				   DateTime::Locale::ml(3)

NAME
DateTime::Locale::ml SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'ml' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Malayalam. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) XXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXXX XXXXXXXXXXX XXXXXXXX XXXXXXXX Abbreviated (format) XXXXXXXX XXXXX XXXXXX XXXXXX XXXXXX XXX XXXXXX Narrow (format) XX XX XX XXXX XX X XX Wide (stand-alone) XXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXXX XXXXXXXXXXX XXXXXXXX XXXXXXXX Abbreviated (stand-alone) XXXXXXXX XXXXX XXXXXX XXXXXX XXXXXX XXX XXXXXX Narrow (stand-alone) XX XX XX XXXX XX X XX Months Wide (format) XXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXX XXXX XXXXX XXXX XXXXXXXX XXXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXXXXX Abbreviated (format) XXX XXXXXX XXXXX XXXXX XXXX XXXXX XXXX XX XXXXXXXX XXXXX XXX XXXX Narrow (format) X XX XX X XX XX XX X XX X X XX Wide (stand-alone) XXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXX XXXX XXXXX XXXX XXXXXXXX XXXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXXXXX Abbreviated (stand-alone) XXX XXXXXX XXXXX XXXXX XXXX XXXXX XXXX XX XXXXXXXX XXXXX XXX XXXX Narrow (stand-alone) X XX XX X XX XX XX X XX X X XX Quarters Wide (format) XXXXXX XXXX XXXXXX XXXX XXXXXXX XXXX XXXXX XXXX Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) XXXXXX XXXX XXXXXX XXXX XXXXXXX XXXX XXXXX XXXX Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide XXXXXXXXXXXXX XXXXXXX XXXXXXXXXXXX XXXXXXX Abbreviated XXXX.XX. XXXX.XX. Narrow XXXX.XX. XXXX.XX. Date Formats Full 2008-02-05T18:30:30 = 2008, XXXXXXXXX 5, XXXXXXXXX 1995-12-22T09:05:02 = 1995, XXXXXXXX 22, XXXXXXXXXXX -0010-09-15T04:44:23 = -10, XXXXXXXXXXXX 15, XXXXXXXX Long 2008-02-05T18:30:30 = 2008, XXXXXXXXX 5 1995-12-22T09:05:02 = 1995, XXXXXXXX 22 -0010-09-15T04:44:23 = -10, XXXXXXXXXXXX 15 Medium 2008-02-05T18:30:30 = 2008, XXXXXX 5 1995-12-22T09:05:02 = 1995, XXXX 22 -0010-09-15T04:44:23 = -10, XXXXXXXX 15 Short 2008-02-05T18:30:30 = 05/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = 2008, XXXXXX 5 1995-12-22T09:05:02 = 1995, XXXX 22 -0010-09-15T04:44:23 = -10, XXXXXXXX 15 Time Formats Full 2008-02-05T18:30:30 = 6:30:30 pm UTC 1995-12-22T09:05:02 = 9:05:02 am UTC -0010-09-15T04:44:23 = 4:44:23 am UTC Long 2008-02-05T18:30:30 = 6:30:30 pm UTC 1995-12-22T09:05:02 = 9:05:02 am UTC -0010-09-15T04:44:23 = 4:44:23 am UTC Medium 2008-02-05T18:30:30 = 6:30:30 pm 1995-12-22T09:05:02 = 9:05:02 am -0010-09-15T04:44:23 = 4:44:23 am Short 2008-02-05T18:30:30 = 6:30 pm 1995-12-22T09:05:02 = 9:05 am -0010-09-15T04:44:23 = 4:44 am Default 2008-02-05T18:30:30 = 6:30:30 pm 1995-12-22T09:05:02 = 9:05:02 am -0010-09-15T04:44:23 = 4:44:23 am Datetime Formats Full 2008-02-05T18:30:30 = 2008, XXXXXXXXX 5, XXXXXXXXX 6:30:30 pm UTC 1995-12-22T09:05:02 = 1995, XXXXXXXX 22, XXXXXXXXXXX 9:05:02 am UTC -0010-09-15T04:44:23 = -10, XXXXXXXXXXXX 15, XXXXXXXX 4:44:23 am UTC Long 2008-02-05T18:30:30 = 2008, XXXXXXXXX 5 6:30:30 pm UTC 1995-12-22T09:05:02 = 1995, XXXXXXXX 22 9:05:02 am UTC -0010-09-15T04:44:23 = -10, XXXXXXXXXXXX 15 4:44:23 am UTC Medium 2008-02-05T18:30:30 = 2008, XXXXXX 5 6:30:30 pm 1995-12-22T09:05:02 = 1995, XXXX 22 9:05:02 am -0010-09-15T04:44:23 = -10, XXXXXXXX 15 4:44:23 am Short 2008-02-05T18:30:30 = 05/02/08 6:30 pm 1995-12-22T09:05:02 = 22/12/95 9:05 am -0010-09-15T04:44:23 = 15/09/-10 4:44 am Default 2008-02-05T18:30:30 = 2008, XXXXXX 5 6:30:30 pm 1995-12-22T09:05:02 = 1995, XXXX 22 9:05:02 am -0010-09-15T04:44:23 = -10, XXXXXXXX 15 4:44:23 am Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 XXXXX 1995-12-22T09:05:02 = 22 XXXXXX -0010-09-15T04:44:23 = 15 XXX Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 pm 1995-12-22T09:05:02 = 9:05 am -0010-09-15T04:44:23 = 4:44 am Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 pm 1995-12-22T09:05:02 = 9:05:02 am -0010-09-15T04:44:23 = 4:44:23 am M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d/M) 2008-02-05T18:30:30 = 5/2 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/9 MEd (M/d, E) 2008-02-05T18:30:30 = 2/5, XXXXX 1995-12-22T09:05:02 = 12/22, XXXXXX -0010-09-15T04:44:23 = 9/15, XXX MMdd (dd-MM) 2008-02-05T18:30:30 = 05-02 1995-12-22T09:05:02 = 22-12 -0010-09-15T04:44:23 = 15-09 MMM (LLL) 2008-02-05T18:30:30 = XXXXXX 1995-12-22T09:05:02 = XXXX -0010-09-15T04:44:23 = XXXXXXXX MMMd (MMM d) 2008-02-05T18:30:30 = XXXXXX 5 1995-12-22T09:05:02 = XXXX 22 -0010-09-15T04:44:23 = XXXXXXXX 15 MMMEd (MMM d, E) 2008-02-05T18:30:30 = XXXXXX 5, XXXXX 1995-12-22T09:05:02 = XXXX 22, XXXXXX -0010-09-15T04:44:23 = XXXXXXXX 15, XXX MMMMd (MMMM d) 2008-02-05T18:30:30 = XXXXXXXXX 5 1995-12-22T09:05:02 = XXXXXXXX 22 -0010-09-15T04:44:23 = XXXXXXXXXXXX 15 MMMMEd (MMMM d, E) 2008-02-05T18:30:30 = XXXXXXXXX 5, XXXXX 1995-12-22T09:05:02 = XXXXXXXX 22, XXXXXX -0010-09-15T04:44:23 = XXXXXXXXXXXX 15, XXX ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (M-y) 2008-02-05T18:30:30 = 2-2008 1995-12-22T09:05:02 = 12-1995 -0010-09-15T04:44:23 = 9--10 yMEd (d-M-yyyy, EEE) 2008-02-05T18:30:30 = 5-2-2008, XXXXX 1995-12-22T09:05:02 = 22-12-1995, XXXXXX -0010-09-15T04:44:23 = 15-9--010, XXX yMMM (y MMM) 2008-02-05T18:30:30 = 2008 XXXXXX 1995-12-22T09:05:02 = 1995 XXXX -0010-09-15T04:44:23 = -10 XXXXXXXX yMMMEd (y MMM d, EEE) 2008-02-05T18:30:30 = 2008 XXXXXX 5, XXXXX 1995-12-22T09:05:02 = 1995 XXXX 22, XXXXXX -0010-09-15T04:44:23 = -10 XXXXXXXX 15, XXX yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 XXXXXXXXX 1995-12-22T09:05:02 = 1995 XXXXXXXX -0010-09-15T04:44:23 = -10 XXXXXXXXXXXX yQ (yyyy Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -010 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMM (MM-yyyy) 2008-02-05T18:30:30 = 02-2008 1995-12-22T09:05:02 = 12-1995 -0010-09-15T04:44:23 = 09--010 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = XXXXXXXXX 2008 1995-12-22T09:05:02 = XXXXXXXX 1995 -0010-09-15T04:44:23 = XXXXXXXXXXXX -10 Miscellaneous Prefers 24 hour time? No Local first day of the week XXXXXXXXXX SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::ml(3)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy