Sponsored Content
Top Forums Shell Programming and Scripting Compare file1 header count with file2 line count Post 302890402 by pone2332 on Wednesday 26th of February 2014 02:37:03 PM
Old 02-26-2014
Updated code: Let me know if that is better or if I'm getting closer.

HDR File:
A: Cat /apps/fmp/ftp/Incoming/FPRS/FPRS/TEST.QDIA_TRIG_HDR* <pipe> to
B: awk '{print $2}' <pipe> integer to
C: sed 's/^0*//' which remove leading 0's.

DET File: Where I made an update.
A: cat /apps/fmp/ftp/Incoming/FPRS/FPRS/TEST.QDIA_TRIG_DET* <pipe> to
B: wc -l

Code:
HDR_count=$(cat /apps/fmp/ftp/Incoming/FPRS/FPRS/TEST.QDIA_TRIG_HDR* | awk '{print $2}'  | sed 's/^0*//' )
DET_count=$(cat /apps/fmp/ftp/Incoming/FPRS/FPRS/TEST.QDIA_TRIG_DET* | wc -l )
if [ ${HDR_count} -ne ${DET_count} ]
then
    echo
        echo "HDR count[ ${HDR_count} ] net equal to DET count [ ${DET_count} ]"
        exit 3
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk Compare f1,f2,f3 of File1 with f1 of File2

I have an Awk string-compare problem and have searched the internet and forums for a solution i could use but cannot find a solution i understand to make work with my particular problem: I need to compare (field1 field2 field3 of File1) against (field1 of File2) and if they match print out... (6 Replies)
Discussion started by: RacerX
6 Replies

2. Shell Programming and Scripting

Awk Compare File1 File2 on f2

I'm trying to compare two files using AWK, where if field2 of both files match, replace field1 of file1 with field1 of file2 and if there is no match just print the line of file1. file1.txt (has empty first field) :ABBATOM:B:H:1992 :ABBA TROJAN:B:H:1993 :ABBES FIRST HOPE:B:M:1997 :ABBEYS... (4 Replies)
Discussion started by: RacerX
4 Replies

3. Shell Programming and Scripting

Compare multiple fields in file1 to file2 and print line and next line

Hello, I have two files that I need to compare and print out the line from file2 that has the first 6 fields matching the first 6 fields in file1. Complicating this are the following restrictions 1. file1 is only a few thousand lines at most and file2 is greater than 2 million 2. I need to... (7 Replies)
Discussion started by: gillesc_mac
7 Replies

4. Shell Programming and Scripting

Shell script to count number of ~ from each line and compare with next line

Hi, I have created one shell script in which it will count number of "~" tilda charactors from each line of the file.But the problem is that i need to count each line count individually, that means. if line one contains 14 "~"s and line two contains 15 "~"s then it should give an error msg.each... (3 Replies)
Discussion started by: Ganesh Khandare
3 Replies

5. UNIX for Dummies Questions & Answers

if matching strings in file1 and file2, add column from file1 to file2

I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string. I'm looking to match column1 in file1 to the number... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

6. Shell Programming and Scripting

look for line from FILE1 at FILE2

Hi guys! I'm trying to write something to find each line of file1 into file2, if line is found return YES, if not found return NO. The result can be written to a new file. Can you please help me out? FILE1 INPUT: WATER CAR SNAKE (in reality this file has about 600 lines each with a... (2 Replies)
Discussion started by: demmel
2 Replies

7. UNIX for Dummies Questions & Answers

File Row Line Count without Header Footer

Hi There! I am saving the file count of all files in a directory to an output file using: wc -l * > FileCount.txt I get: 114 G4SXORD 3 G4SXORH 0 G4SXORP 117 total But this count includes header and footer. I want to subtract 2 from the count and get ... (7 Replies)
Discussion started by: gagan8877
7 Replies

8. Shell Programming and Scripting

Compare file1 for matching line in file2 and print the difference in matching lines

Hello, I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies

9. Shell Programming and Scripting

Compare and find records of file1 not in file2

hi.. i am using solaris system and ksh and using nawk to get records of file1 not in file2(not line by line comparison). code i am using is nawk 'NR==FNR{a++} !a {print"line:" FNR"->" $0} ' file2 file1 same command with awk runs perfectly on darwin kernel(mac) but in solaris it does line by... (2 Replies)
Discussion started by: Abhiraj Singh
2 Replies

10. UNIX for Dummies Questions & Answers

Compare file1 and file2, print matching lines in same order as file1

I want to print only the lines in file2 that match file1, in the same order as they appear in file 1 file1 file2 desired output: I'm getting the lines to match awk 'FNR==NR {a++}; FNR!=NR && a' file1 file2 but they are in sorted order, which is not what I want: Can anyone... (4 Replies)
Discussion started by: pathunkathunk
4 Replies
PURIFYEPS(1)															      PURIFYEPS(1)

NAME
purifyeps - make an Encapsulated PostScript file work with both dvips and pdflatex SYNOPSIS
purifyeps --help purifyeps --version purifyeps [--fontmap=.fmp file] [.eps input file [.eps output file]] purifyeps --make-man[=filename] [--section=section] purifyeps --make-ps-man[=filename] [--section=section] DESCRIPTION
While pdflatex has a number of nice features, its primary shortcoming relative to standard latex+dvips is that it is unable to read ordinary Encapsulated PostScript (EPS) files, the most common graphics format in the LaTeX world. pdflatex can read only the following types of graphics files: PDF Most people who use pdflatex convert their documents to PDF using a utility such as epstopdf. This works well and preserves the vector nature of the original EPS. Unfortunately, dvips does not read PDF, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex. PNG PNG is a bitmap format and therefore scales poorly. Also, dvips does not read PNG, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex. JPEG JPEG is a bitmap format and therefore scales poorly. Also, dvips does not read JPEG, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex. MPS This is probably the least-used pdflatex-compatible graphics format. MPS is actually a stylized version of EPS that MetaPost outputs. Like PDF, MPS is a vector format and remains as such when imported into a pdflatex document. Also like PDF, dvips does not read MPS, so two versions of the graphic must be maintained if the document is to be processed with both latex+dvips and pdflatex. The insight behind purifyeps is that there are only a few, small differences between MPS and EPS and that a file can be converted into a format that matches both the MPS and EPS specifications simultaneously. purifyeps inputs an EPS file, uses pstoedit's "mpost" filter to convert the file to MetaPost (.mp), runs mpost on the file to convert it to MPS, and finally performs some touchups on the result to convert the file back to EPS, while preserving its ability to be parsed by pdflatex. OPTIONS
--help Display "Usage" and "Options" from the purifyeps documentation. -V, --version Display the purifyeps version number, copyright, and license. --fontmap=.fmp file Specify the name of a file that tells purifyeps how to map from TeX font names to PostScript font names. [Default: mpost.fmp] --make-man [=filename]] [--section=section] Automatically create a Unix man page for purifyeps. section specifies the section [default: 1 (User Commands)]. filename defaults to purifyeps.1 or an analogous filename if section is specified. --make-ps-man [=filename]] [--section=section] Automatically create a PostScript version of the purifyeps documentation. The documentation is formatted like a Unix man page. section specifies the section [default: 1 (User Commands)]. filename defaults to purifyeps.ps. In normal operation (i.e., when not run with "--help", "--make-man", or "--make-ps-man"), purifyeps takes the name of an input file and output file. The same filename can safely be used for both files. If the output filename is omitted, output will go to the standard output device. If the input filename is omitted, purifyeps will read from the standard input device. EXAMPLES
Create a PostScript version of the purifyeps documentation, but call it happydoc.ps instead of the default, purifyeps.ps: purifyeps --make-ps-man=happydoc.ps Create a Unix man page for purifyeps (in the usual roff format), but indicate that it belongs in section "LOCAL" instead of the default of section 1: purifyeps --make-man --section=LOCAL Purify sample.eps (mpost.fmp is in the current directory): purifyeps sample.eps sample.eps Purify sample.eps (mpost.fmp is in a different location): purifyeps --fontmap=/usr/share/pstoedit/mpost.fmp sample.eps sample.eps Rename the purified version while purifying: purifyeps sample.eps sample-pure.eps Do the same, but in a Unix pipeline: cat sample.eps | purifyeps > sample-pure.eps When you run purifyeps, you should see the output from both pstoedit and mpost, followed by a success message from purifyeps: % cat sample.eps | purifyeps > sample-pure.eps pstoedit: version 3.30 / DLL interface 107 (build Mar 14 2002) : Copyright (C) 1993 - 2001 Wolfgang Glunz Interpreter finished. Return status 0 This is MetaPost, Version 0.641 (Web2C 7.3.1) (/tmp/purifyeps-jdeGPkh9.mp [1] ) 1 output file written: purifyeps-jdeGPkh9.1 Transcript written on purifyeps-jdeGPkh9.log. File seems to have been purified successfully. FILES
mpost.fmp File containing mappings between TeX and PostScript font names. See "NOTES" for a description of this file's contents. BUGS
Error reporting could definitely stand to be improved. Error messages produced by pstoedit and mpost are sometimes silently ignored. Also, errors sometimes cause purifyeps to leave temporary files (purifyeps-#####) lying around. purifyeps is subject to all of the limitations that affect pstoedit and especially the "mpost" backend to pstoedit. As a result, purifyeps ignores certain PostScript constructs, such as nonuniformly scaled text. NOTES
purifyeps needs a file that tells it how to map from TeX font names to PostScript font names. This file must contain two, space-separated columns. The first lists a PostScript font name, and the second lists the TeX equivalent. Blank lines and lines that start with "%" are ignored. The following is a sample .fmp file: % This is a sample font map for purifyeps. Times-Bold ptmb Times-Italic ptmri Times-Roman ptmr Helvetica phvr Helvetica-Bold phvb Helvetica-Oblique phvro Courier pcrr Courier-Bold pcrb Courier-Oblique pcrro Note that this is exactly the same format that pstoedit uses. By default, purifyeps looks in the current directory for a font map called mpost.fmp. The "--fontmap" command-line option tells purifyeps to use a different font map, which will typically be the mpost.fmp file that comes with pstoedit. Once you create purified EPS files with purifyeps, you need to instruct pdflatex to use them. The pdfLaTeX configuration of the "graphics" and "graphicx" packages (pdftex.def) normally ignores .eps files. Putting the following LaTeX code in your document's preamble tells pdflatex that all .eps files are in MPS format: % Tell pdfLaTeX that all .eps files were produced by MetaPost. usepackage{graphicx} % or graphics usepackage{ifpdf} ifpdf DeclareGraphicsRule{.eps}{mps}{*}{} makeatletter g@addto@macroGin@extensions{,.eps} makeatother fi SEE ALSO
dvips(1), epstopdf(1), latex(1), mpost(1), pdflatex(1), pstoedit(1) AUTHOR
Scott Pakin, scott+peps@pakin.org v1.1 2010-11-28 PURIFYEPS(1)
All times are GMT -4. The time now is 06:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy