data extraction from a file

Hi Freinds,

I have a file1.txt in the following format

File1.txt

I want to get 2 files from the above file filextra.txt should have the lines which are ending with "<" and remaining lines in the filecompare.txt file.

Please help.

$ grep "<$" temp_tst
29123973�2012-05-29�35310124�00000000000469744762�00010�20�390����F<


$ grep -v "<$" temp_tst
29123985�2012-05-29�35310136�00000000000469745009�00010�20�390����F|29123985�20112-05-29�35310136�00000000000469745009�00010�20�390����F
1 Like
sed '/<$/{
w filextra.txt
d
}' file1.txt > filecompare.txt
1 Like

@pamu,@elixir Thanks for the inputs :slight_smile: its working