awk + sorting file according to values in the file and write two diffrent files -
I have the value of the right eye in the file and how the left eye is
and to write different values in File1
and file1
and file2
/ code to write different values in file1 file2 < >
should be 1 file
:
Name: Jim Last Name: Baker right eye: & gt; | 5 | & Lt; Left eye VALUE: & gt; | 5 | & Lt; Name: David Last Name: Ear Right Eye: & gt; | 9 | & Lt; Left eye VALUE: & gt; | 9 | & Lt;
should be file2
:
Name: Jorg Last Name: mitchel right eye: & gt; | 3 | & Lt; Left eye VALUE: & gt; | 5 | & Lt; Name: Jamie Last Name: Right Eye of Cartridge: & gt; | 6 | & Lt; Left eye VALUE: & gt; | 5 | & Lt;
I am using Perl for this:
Open my $ F, "& lt;", "file_input"; Open your $ file1, "& gt;", "file1"; Open your $ file2, "& gt;", "file2"; While (! Eof ($ f)) {my $ person; $ Person = & Lt; $ F & gt; For (1..4); Read the # 4 lines on my ($ right) = ($ person = ~ /rightright.*? (\ D +) / M); Mine ($ left) = ($ person = ~ /^left.*? (\ D +) / m); My $ file = ($ right == $ left)? $ File1: $ file2; Print $ file $ person; } $ F; About $ file1; Close $ File2
Comments
Post a Comment