Sponsored Content
Top Forums Shell Programming and Scripting Apply condition on fixed width file and filter records Post 302534236 by sureshg_sampat on Monday 27th of June 2011 08:48:55 AM
Old 06-27-2011
Apply condition on fixed width file and filter records

Dear members..

I have a fixed width file. Requirement is as below:-
1. Scan each record from this fixed width file
2. Check for value under field no "6" equals to "ABC". If yes, then filter this record into the output file

Please suggest a unix command to achieve this, my guess awk might work here

Thanks in advance
Suresh
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Fixed Width file using AWK

I am using the following command at the Unix prompt to make my 'infile' into a fixed width file of 100 characters. awk '{printf "%-100s\n",$0}' infile > outfile However, there are some records with a special character "©" These records are using 3 characters in place of one and my record... (2 Replies)
Discussion started by: alok.benjwal
2 Replies

2. Shell Programming and Scripting

Extracting records with unique fields from a fixed width txt file

Greetings, I would like to extract records from a fixed width text file that have unique field elements. Data is structured like this: John A Smith NY Mary C Jones WA Adam J Clark PA Mary Jones WA Fieldname / start-end position Firstname 1-10... (8 Replies)
Discussion started by: sitney
8 Replies

3. UNIX Desktop Questions & Answers

Help with Fixed width File Parsing

I am trying to parse a Fixed width file with data as below. I am trying to assign column values from each record to variables. When I parse the data, the spaces in all coumns are dropped. I would like to retain the spaces as part of the dat stored in the variables. Any help is appreciated. I... (4 Replies)
Discussion started by: sate911
4 Replies

4. Shell Programming and Scripting

Fixed-Width file from Oracle

Hi All, I have created a script which generates FIXED-WIDTH file by executing Oracle query. SELECT RPAD(NVL(col1,CHR(9)),20)||NVL(col2,CHR(9))||NVL(col3,CHR(9) FROM XYZ It generates the data file with proper alignment. But if same file i transfer to windows server or Mainframe... (5 Replies)
Discussion started by: Amit.Sagpariya
5 Replies

5. Shell Programming and Scripting

Manupulating Records in a fixed width file

I am trying to determine what would be a fast and simple way to manipulate data that comes in a fixed width format. This data has 6 segments within a record. Each record needs to written out with a header and the 6 segments. Based on the value in column #6 the fields will be defined accordingly.... (4 Replies)
Discussion started by: Muga801
4 Replies

6. Shell Programming and Scripting

Comparing two fixed width file

Hi Guys I am checking the treads to get the answer but i am not able to get the answer for my question. I have two files. First file is a pattern file and the second file is the file i want to search in it. Output will be the lines from file2. File1: P2797f12af 44751228... (10 Replies)
Discussion started by: anshul_er
10 Replies

7. UNIX for Dummies Questions & Answers

Length of a fixed width file

I have a fixed width file of length 53. when is try to get the lengh of the record of that file i get 2 different answers. awk '{print length;exit}' <File_name> The above code gives me length 50. wc -L <File_name> The above code gives me length 53. Please clarify on... (2 Replies)
Discussion started by: Amrutha24
2 Replies

8. Shell Programming and Scripting

Alter Fixed Width File

Thank u so much .Its working fine as expected. ---------- Post updated at 03:41 PM ---------- Previous update was at 01:46 PM ---------- I need one more help. I have another file(fixed length) that will get negative value (ex:-00000000003000) in postion (98 - 112) then i have to... (6 Replies)
Discussion started by: vinus
6 Replies

9. Shell Programming and Scripting

UNIX command -Filter rows in fixed width file based on column values

Hi All, I am trying to select the rows in a fixed width file based on values in the columns. I want to select only the rows if column position 3-4 has the value AB I am using cut command to get the column values. Is it possible to check if cut -c3-4 = AB is true then select only that... (2 Replies)
Discussion started by: ashok.k
2 Replies

10. Shell Programming and Scripting

Filter duplicate records from csv file with condition on one column

I have csv file with 30, 40 columns Pasting just three column for problem description I want to filter record if column 1 matches CN or DN then, check for values in column 2 if column contain 1235, 1235 then in column 3 values must be sequence of 2345, 2345 and if column 2 contains 6789, 6789... (5 Replies)
Discussion started by: as7951
5 Replies
ln03rof(8)						      System Manager's Manual							ln03rof(8)

Name
       ln03rof, ln03rof_isolatin1, ln03rof_decmcs - LN03R ASCII to PostScript translation filters

Syntax
       /usr/lib/lpdfilters/ln03rof [-c] [-nlogin] [-h host] [-wwidth] [-lnum] [-iindent]  [accounting file]

Description
       The  filter translates ASCII to PostScript, handles the device dependencies of a PostScript printer and performs some accounting functions.
       PostScript printers print documents formatted in the PostScript Page Description Language only.

       The and filters are alternatives to and affect how ASCII documents are printed.	They cause the encoding vectors for ISO Latin1 or DEC  MCS
       to  be  used  instead of the Adobe Standard Encoding Vector described in the LN03R PostScript Programmers Supplement.  The filter uses idle
       cycles to cache the fonts when accessed by the standard encoding vector.  The cached fonts cannot be used by or which means that small jobs
       are slowed down.

       The  filter  is	transparent to documents already formatted in PostScript.  The filter assumes that all other documents are plain ASCII and
       translates them into PostScript.  The decision to translate is based on the first two characters in the document. If  they  are	`%!',  the
       filter  assumes	the  document has already been formatted in PostScript.  If the first two characters are not `%!', the filter assumes that
       the document is plain ASCII and translates it into PostScript.  The filter ensures that the printer receives documents formatted  in  Post-
       Script  only.  The filter maintains accounting information only for documents that it translates.  You specify the accounting file with the
       af field in the file.  For further information, see

       You can specify the filter in both the of and the if fields of the file. The specification of the filter in the	file  determines  how  the
       command affects the printed document. For example:

       o   If you specify it in the of field only and do not suppress banner pages, the filter always translates the document into PostScript.

       o   If  you  specify  it  in  the if field and do not suppress banner pages, the document does not print.  In this case, the banner is sent
	   directly to the printer. Since the banner is not formatted in PostScript, the printer cannot print the document and aborts the job.

       o   If you suppress the banner by including the sh field in or by printing the file using the with the -h option, the document prints  cor-
	   rectly.

       o   You can obtain the best results by specifying the filter in both the of and if fields.

       The ASCII data type for PrintServer software uses the filter.  For more information about how the PostScript translator is invoked, see

       The filter sets a landscape print mode with a smaller font if the width is greater than 80 columns.  The default width for the entry in the
       file is 132.  To print using portrait mode, modify the file to include the following two entries:
       :pl#66:
       :pw#80:
       When printing in portrait mode, if the job page length is greater than 66 a smaller font is used.

       For a more detailed discussion on filters see the ``Line Printer Spooler Manual'' in the Supplementary Documents, Volume 2: Programmer.

Options
       The arguments passed to the filter depend on its use.

       The of filter is called with the following arguments:

       -llength
	  Specify length values from the pl field in the file .

       -wwidth
	  Specify width values from the pw field in the file.

       The if filter is passed the following arguments:

       -c Print control characters when you use the -l option of to print the file.  (Optional flag).

       -hhost
	  Specify the host name of the job owner.  (Used to record accounting information).

       -iindent
	  Specify the amount of indentation to be used.  The last argument is the name of the accounting file specified from the af field  in  the
	  file.

       -llength
	  Specify  length value from the pl field in the file as it does with the of filter.  Arguments may have different values if the -w and/or
	  -z options of were used to print the file.

       -nlogin
	  Specify the login name of the job owner.  (Used to record accounting information).

       -wwidth
	  Specify width value from the pw field in the file as it does with the of filter.  Arguments may have different values if the	-w  and/or
	  -z options of were used to print the file.  These arguments only affect documents that are translated from ASCII to PostScript.

Diagnostics
       The lf field (default /dev/null) in the file specifies the error logging file name.

Files
       Printer capabilities database.

       Shell script to invoke PostScript translators.

See Also
       lpr(1), pr(1), printcap(5), lpd(8), MAKEDEV(8), pac(8), xlator_call(8)
       "Line Printer Spooler Manual", Supplementary Documents, Volume 2: Programmer

																	ln03rof(8)
All times are GMT -4. The time now is 09:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy