Sponsored Content
Top Forums Shell Programming and Scripting Pad zeroes first field in a Delimited file Post 302589086 by johnhips on Tuesday 10th of January 2012 07:56:05 PM
Old 01-10-2012
So much thanks Chubler_XL !!!!

---------- Post updated at 07:56 PM ---------- Previous update was at 07:29 PM ----------

Can I use printf in this awk to pad my variable 'n' counter???

Code:
	awk -F \| '
	    NR == 1 { print "\"KEYRECORD\"|" $0; next; }
	    {
       	 if( $4 == "\"          \"" && last5 != $5) {
       	     n++;
	        } 

	        print n "|" $0;
	        last = $4;
	        last5 = $5;

	    }
	'  $CUSTFINAL > $CUSTFINAL2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to trim the leading zeroes in a Currency field ?

How do I trim the leading zeroes, and (+,-) in the currency field ? I have a text file. Your bill of +00002780.96 for a/c no. 25287324 is due on 11-06. Your bill of +00422270.48 for a/c no. 28931373 is due on 11-06. I want the O/P file to be like. Your bill of 2780.96 for a/c no. 25287324... (22 Replies)
Discussion started by: Amruta Pitkar
22 Replies

2. Shell Programming and Scripting

Count field frequency in a '|' delimited file

I have a large file with fields delimited by '|', and I want to run some analysis on it. What I want to do is count how many times each field is populated, or list the frequency of population for each field. I am in a Sun OS environment. Thanks, - CB (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

3. Shell Programming and Scripting

insert a field into a tab delimited file

Hello, Can someone help me to do this with awk or sed? I have a file with multiple lines, each line has many fields separated with a tab. I would like to add one more field holding 'na' in between the first and second fields. old file looks like, 1, field1 field2 field3 ... 2, field1... (7 Replies)
Discussion started by: ssshen
7 Replies

4. UNIX for Dummies Questions & Answers

Insert Field into a tab-delimited file

Hello, I have about 100 files in a directory with fields which are tab delimited. I would like to append the file name as the first field and it has to be done as many times as the total lines in the file. For example, myFile1.txt has the following data: 1 x y z 2 a b ... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

5. Shell Programming and Scripting

Remove leading zeroes in 2nd field using sed

Hi Forum. I tried searching the forum but couldn't find a solution for my question. I have the following data and would like to have a sed syntax to remove the leading zeroes from the 2nd field only: Before: 2010-01-01|123|1|1000|2000|500|1500|600|700... (18 Replies)
Discussion started by: pchang
18 Replies

6. UNIX for Dummies Questions & Answers

Trim and pad a field in the middle of unix file

Hello, I have a file with several lines and I need to trim and pad with spaces the data that are between position 6 and 15 included. Data in position 1 to 5 and after 15 could be anything, and should stay as they are. For instance, the following records in a file (underscore = space)... (4 Replies)
Discussion started by: BSF
4 Replies

7. Shell Programming and Scripting

sed command to remove the first field from a '|' delimited file

Hi I have a file with fields delimited by |. I need to remove the first field from the file. I tried cut but it just extracts that field. sample.output abc|100|name1 cde|200|name2 efg|300|name3 Output should be sample.output 100|name1 200|name2 300|name3 thanks Var (6 Replies)
Discussion started by: var285
6 Replies

8. Shell Programming and Scripting

Remove Last field from a delimited file

Hi, I have a '~' delimited file and i want to remove the last field using awk. Please find the sample records below: 1428128~1~0~1100426~003~50220~005~14~0~194801~11~0~3~14~0~50419052335~0~0820652001~2~00653862 ~0~1~0~00126~1~20000110~20110423~R~ ~0~Z~1662.94~ ~002041~0045~Z~... (3 Replies)
Discussion started by: Arun Mishra
3 Replies

9. Shell Programming and Scripting

How to pad zeroes based on input string?

Hello everyone, I am comparing two floating point numbers by storing them in seperate files and then using difference command to verify,it is working fine. But I want to compare two values which will come at 4 precision places. ex: file1 Date,Count,Checksum... (7 Replies)
Discussion started by: karthik adiga
7 Replies

10. Shell Programming and Scripting

Replace field in the delimited file

Hi, I have the requirement similar to the one mentioned in the below thread. https://www.unix.com/unix-for-dummies-questions-and-answers/128155-search-replace-string-only-particular-column-delimited-file.html The only difference is that I need to change the field for row 1,2 and the last... (14 Replies)
Discussion started by: chetanojha
14 Replies
GStreamer::PadTemplate(3pm)				User Contributed Perl Documentation			       GStreamer::PadTemplate(3pm)

NAME
GStreamer::PadTemplate - Describe the media type of a pad. HIERARCHY
Glib::Object +----GStreamer::Object +----GStreamer::PadTemplate METHODS
padtemplate = GStreamer::PadTemplate->new ($name_template, $direction, $presence, $caps) o $name_template (string) o $direction (GStreamer::PadDirection) o $presence (GStreamer::PadPresence) o $caps (GStreamer::Caps) caps = $templ->get_caps paddirection = $templ->get_direction string = $templ->get_name_template $templ->pad_created ($pad) o $pad (GStreamer::Pad) padpresence = $templ->get_presence PROPERTIES
'caps' (GStreamer::Caps : default undef : readable / writable / construct-only / private) The capabilities of the pad described by the pad template 'direction' (GStreamer::PadDirection : default "unknown" : readable / writable / construct-only / private) The direction of the pad described by the pad template 'name-template' (string : default undef : readable / writable / construct-only / private) The name template of the pad template 'presence' (GStreamer::PadPresence : default "always" : readable / writable / construct-only / private) When the pad described by the pad template will become available SIGNALS
pad-created (GStreamer::PadTemplate, GStreamer::Pad) ENUMS AND FLAGS
enum GStreamer::PadDirection o 'unknown' / 'GST_PAD_UNKNOWN' o 'src' / 'GST_PAD_SRC' o 'sink' / 'GST_PAD_SINK' enum GStreamer::PadPresence o 'always' / 'GST_PAD_ALWAYS' o 'sometimes' / 'GST_PAD_SOMETIMES' o 'request' / 'GST_PAD_REQUEST' SEE ALSO
GStreamer, Glib::Object, GStreamer::Object COPYRIGHT
Copyright (C) 2005-2011 by the gtk2-perl team. This software is licensed under the LGPL. See GStreamer for a full notice. perl v5.14.2 2012-03-01 GStreamer::PadTemplate(3pm)
All times are GMT -4. The time now is 02:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy