Sponsored Content
Full Discussion: Check 2 files ???
Top Forums Shell Programming and Scripting Check 2 files ??? Post 99226 by sabercats on Wednesday 15th of February 2006 01:57:33 PM
Old 02-15-2006
Check 2 files ???

Hi all,

I know how to count lines, count byte of a file, but really dont know how to compare line , I am newbie and hope you can help me to learn more about UNIX.
Here is my problem.
====
How :

1. File A (Flatfile with NAME|DATE|ID1|ID2|ID3|ID4|ID5)
CJKA|2005-12-10-08.01.30.000000|1111111111|ECI|1112221111|1113331111|1114441111
DMCH|2005-12-10-08.28.00.000000|1111113333|CCCOSSR|1112223333|1113333333|1114443333
DLMQ|2005-12-11-01.00.00.000000|1111117777|STLITE|1112227777|1113337777|1114447777
DMCH|2005-12-10-08.20.00.000000|1111114444|MTRRD|1112224444|1113334444|1114444444
CJKA|2005-12-10-08.10.00.000000|1111112222|OMCRTVI|1112222222|1113332222|1114442222
R1L7|2005-12-10-08.11.00.000000|1111115555|CLAIMS|1112225555||
DLMQ|2005-12-10-08.00.00.000000|1111116666|QAS1|1112226666|1113336666|1114446666
DLMQ|2005-12-11-01.10.00.000000|1111118888|SVCPLN|1112228888|1113338888|1114448888
CJKA|2005-12-10-08.13.30.000000|1111119999|OMCRTVI|1112229999|1113339999|1114449999

2. File B ( 4 lines)
records='9'
bytes='724'
CJKA|2005-12-10-08.01.30.000000|1111111111|ECI|1112221111|1113331111|1114441111
CJKA|2005-12-10-08.13.30.000000|1111119999|OMCRTVI|1112229999|1113339999|1114449999

How we write a ksh script to compare and give another output file

1. a. Check record count in file A is equal 9 in file B.
b. Check byte count in file A is equal line 2 file B 724
c. First record in File A is line 4 in file B
d. last record in file A is line 4 in File B

If it did not match then give the error do not match . Which one is not match

2. If it is match then give the out put
File C name is yyyymmdd.dat in 2nd field of file A , like 20051210.dat , it will be a flatfile
NAME|DATE||||ID4|ID3
====

Thanks for sharing your knowledge .
 

10 More Discussions You Might Find Interesting

1. Solaris

How to check no. of files open currently

I'm getting an error "too many files open" # ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) unlimited stack(kbytes) 8192 coredump(blocks) unlimited nofiles(descriptors) 256 memory(kbytes) unlimited # hard limit shows 1024 I would like to know how many files... (1 Reply)
Discussion started by: max_min
1 Replies

2. Shell Programming and Scripting

check whether 3 files are present

I'm trying to check whether 3 files are existing and send 3 files as attachements. If only two are there then send those two files as attachments. if ; then elif ; then I tired the above given syntax and then it is giving me an error line 11: ' I tried with -a instead of && and... (3 Replies)
Discussion started by: Celvin VK
3 Replies

3. Shell Programming and Scripting

How to check files and move the results to differents files?

Hi, I am a newbie to shell scripting. here is my objective: 1)The shell program should take 2 parameters - ie-> DestinationFolder, WebFolder 2)Destination folder contains few files that has to has be verified and deleted. 3)WebFolder is a folder containing a list of master files 4)It... (1 Reply)
Discussion started by: sandhyagupta
1 Replies

4. Shell Programming and Scripting

how to check files

Hi, I have a dir in which I need to check for 3 files. and naming for three files are as below. fileone_yyyy_mm_dd.dat filetwo_yyyy_mm_dd.dat filethree_yyyy_mm_dd.datand YYYY_mm_dd will change everyday as the date changes. I need to check everyday all these files are existing or not... (4 Replies)
Discussion started by: ravinunna
4 Replies

5. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

6. Shell Programming and Scripting

Perl code to check date and check files in particular dir

Hi Experts, I am checking how to get day in Perl. If it is “Monday” I need to process…below is the pseudo code. Can you please prove the code for below condition. if (today=="Monday" ) { while (current_time LESS THAN 9:01 AM) ... (1 Reply)
Discussion started by: ajaypatil_am
1 Replies

7. Shell Programming and Scripting

Kindly check it: Camparison of files only column1 of 2 files

Hi all, I have 2 files in which i have to find commom entries in column 1 an dif soemthing is common write other data of both files in front of it mentioned. Gene symbol and disease name column 1 column2 ARFGEF2 CAD DDEF2 CAD PSCD3 CAD PSCD4 CAD CAMK1... (15 Replies)
Discussion started by: manigrover
15 Replies

8. Shell Programming and Scripting

Check for data between two files

I have two files File1.txt 000199458 000199463 000200442 000200831 000200866 000201009 000201050 000201405 000201666 000201682 File2.txt (4 Replies)
Discussion started by: halfafringe
4 Replies

9. Shell Programming and Scripting

Check files and archive the files using sftp

Hi, I have to check the files in another server using sftp to do that, below is the code i am going with #!/bin/bash export SRC_FOLDER=$1 export ARC_FOLDER=$2 HOST=as07u3456 USER=relfag sftp ${USER}@${HOST} <<EOF cd $SRC_FOLDER/DSCOR ls bye EOF echo "done" whatever the files i... (8 Replies)
Discussion started by: ursrami
8 Replies

10. Shell Programming and Scripting

How to get CRC check sum of files in java EAR file without extracting .jar/.war files to disk.?

unzip -v gives CRC info of each file in a zip(in my case .EAR) file. # unzip -v my-application.ear Archive: my-application.ear Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 197981 Defl:N 183708 7%... (1 Reply)
Discussion started by: kchinnam
1 Replies
selinux_raw_context_to_color(3) 			     Library Functions Manual				   selinux_raw_context_to_color(3)

NAME
selinux_raw_context_to_color - Return RGB color string for an SELinux security context SYNOPSIS
#include <selinux/selinux.h> int selinux_raw_context_to_color(security_context_t raw, char **color_str); DESCRIPTION
selinux_raw_context_to_color() returns a color_str associated to the raw context raw provided that the mcstransd(8) daemon is running, the policy is an MLS type policy (MCS or MLS) and there is a color configuration file secolor.conf(5) (see the FILES section). The color_str string is a space separated list of eight hexadecimal RGB triples, each prefixed by a hash character (#). These represent the user:role:type:range components of the foreground and background colors. An example string is shown in the EXAMPLE section. The returned color_str string must be freed with free(3). If a color has not been configured for a specific user, role, type and/or range component of context raw, then selinux_raw_context_to_color() will select the color returned in color_str in order of precedence as follows: role, type, range user, type, range user, role, range user, role, type If there are no entries in the secolor.conf(5) file for any of the components of context raw (or the file is not present), then the default string returned in color_str is: ----- user ---- ---- role ---- ---- type ---- ---- range ---- #000000 #ffffff #000000 #ffffff #000000 #ffffff #000000 #ffffff RETURN VALUE
On success, zero is returned. On failure, -1 is returned with errno set appropriately. ERRORS
ENOENT If the mcstransd(8) daemon is not running. FILES
selinux_raw_context_to_color() obtains the translated entry from the active policy secolor.conf(5) file as returned by selinux_colors_path(3). The file format is described in secolor.conf(5). NOTES
1. The primary use of selinux_raw_context_to_color() is to return a color that corresponds to a range, that can then be used to highlight information at different MLS levels. 2. The mcstransd(8) daemon process security level must dominate the raw security level passed to it by the selinux_raw_context_to_color() function. If not, the range color selected will be as defined by the order of precedence. EXAMPLE
selinux_raw_context_to_color() returns the foreground and background colors of the context string components (user:role:type:range) as RGB triples as follows: user : role : type : range fg bg : fg bg : fg bg : fg bg #000000 #ffffff #ffffff #000000 #d2b48c #ffa500 #000000 #008000 black white : white black : tan orange : black green SEE ALSO
selinux(8), selinux_colors_path(3), mcstransd(8), secolor.conf(5), selinux_raw_to_trans_context(3), selinux_trans_to_raw_context(3), free(3) SELinux API documentation 08 April 2011 selinux_raw_context_to_color(3)
All times are GMT -4. The time now is 03:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy