I have to join two files based on 1st column where 4th column of a2.txt=at and take 2nd column of a1.txt and 3rd column of a2.txt and check against source files ,if matches list those source file names.
With my nawk on Solaris 'system' seems to return the status of the 'spawning' of the command, rather than the return status of the command (although the 'man nawk' says otherwise).
I used to check for the file existence with the 'getline':
---------- Post updated at 05:19 PM ---------- Previous update was at 05:16 PM ----------
I missed the "at" part in both solutions
Adding it is left as an exercise.
---------- Post updated at 05:24 PM ---------- Previous update was at 05:19 PM ----------
Quote:
Originally Posted by vgersh99
With my nawk on Solaris 'system' seem to return the status of the 'spawning' of the command, rather than the return status of the command (although the 'man nawk' says otherwise).
I used to check for file existence with the 'getline':
Yep,
it does not work as expected on Solaris (I'll check later).
---------- Post updated at 05:28 PM ---------- Previous update was at 05:24 PM ----------
I think I should post a correct answer later (my both solutions are wrong). Got to go now ...
---------- Post updated at 07:35 PM ---------- Previous update was at 05:28 PM ----------
Actually, if I'm not missing something, this seems to work on my Solaris machine:
[ some old shells like bsh do not support the -e test option, so I changed it to -f ]
Modified Perl version:
I agree with vgersh99 that it's better to do the test inside awk without spawning an external command,
but I'd like to point out the that approach assumes that the files are readable..
Hi all
I have two files I need to match record from first file and second file on column 1,8 and and output only match records on file1
File1:
020059801803180116130926800002090000800231000245204003160000000002000461OUNCE000000350000100152500BM01007W0000 ... (5 Replies)
Hi,
I have two files in the following format. I am trying to compare the first column of both the files and if the values match the rows in file tst6 should be replaced in tst1.
File tst1
S00823295|MIDDL|0|MR|019221521A||RL|STD|0|0||E
S00862481|ESSEX|0|MR|018163650A||R|STD|0|0||E... (1 Reply)
Given a file such as this I need to remove the duplicates.
00060011 PAUL BOWSTEIN ad_waq3_921_20100826_010517.txt
00060011 PAUL BOWSTEIN ad_waq3_921_20100827_010528.txt
0624-01 RUT CORPORATION ad_sade3_10_20100827_010528.txt
0624-01 RUT CORPORATION ... (13 Replies)
Hi All,
I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations:
1. I am restrained to 2 input files only.
2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Condition1;
If NPID and IndID of both input1 and input2 are same take all the vaues relevant to them and print together as output
Condition2;
IDNo in output: Take the highly repeated same letter of similar NPID-IndID as *1*
Second highly repeated same letter... (0 Replies)
I need a script (perl or awk..anything is fine) to join 3 files based on three key columns. The no of non-key columns can vary in each file. The columns are delimited by semicolon.
For example,
File1
Dim1;Dim2;Dim3;Fact1;Fact2;Fact3;Fact4;Fact5
---- data delimited by semicolon ---
... (1 Reply)
I've got two files, File1 and File2
File 1 has got combination of col1, col2 and col3 which comes on file2 as well, file2 does not get
col4. Now based on col1, col2 and col3, I would like to get col4 from file1 and all the columns from file2 in a new file
Any ideas?
File1
------
Col1 col2... (11 Replies)
I am trying to join/paste columns from two files for the rows with matching first field. Any help will be appreciated.
Files can not be sorted and may not have all rows in both files.
Thanks.
File1
aaa 111
bbb 222
ccc 333
File2
aaa sss mmmm
ccc kkkk llll
ddd xxx yyy
Want to... (1 Reply)
I have to merge two files:
The files are having the same format like
A0this is first line
TOlast line
silmilarly other lines.
I have to search for A0 line in the second file also and then put the data in the third file under A0 heading ,then for A1 and so on.
A0 portion will be treminated... (1 Reply)